<SlashIDProvider>
SlashIDProvider
uses React Context to enable dependent child components to react to changes in authentication state. It should be rendered as close to the application root as possible. There should only be a single instance of this provider in the component hierarchy.
Usage
import { SlashIDProvider } from "@slashid/react"
function Root() {
return (
<SlashIDProvider oid="ORGANIZATION_ID" tokenStorage="localStorage">
<App />
</SlashIDProvider>
)
}
Props
Name | Type | Default | Description |
---|---|---|---|
oid | string | The organization ID you get when signing up with SlashID | |
initialToken? | string | Given a valid initial token, SDK will initialize with a User based on that token | |
tokenStorage? | "memory" | "localStorage" | "memory" | Where SlashID user tokens are stored. Set to "localStorage" to enable persistence. |
baseApiUrl? | string | "https://api.sandbox.slashid.com" | The base SlashID API endpoint |
sdkUrl? | boolean | "https://cdn.sandbox.slashid.com/sdk.html" | The location where your organization's custom SDK is served |
analyticsEnabled? | boolean | true | Enable collection of client side analytics events |
anonymousUsersEnabled? | boolean | false | Enable support for anonymous users, if false then anonymous user tokens are treated as invalid |
themeProps? | { theme?: Theme, className?: string} | { theme: "auto"} | Set the UI theme (auto , light or dark ) and apply a CSS class name to the theme root |