Skip to main content

<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

NameTypeDefaultDescription
oidstringThe organization ID you get when signing up with /id
initialToken?stringGiven 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?booleantrueEnable collection of client side analytics events
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