Skip to main content


useSlashID() acts as a wrapper on top of the low level /id SDK. The core SDK is designed to be stateless, while this hook will keep track of authentication state changes. It can be used like this:


import { useSlashID } from "@slashid/react"

function Component() {
const { user, anonymousUser, logIn, logOut, sid, isLoading, isAuthenticated } = useSlashID()
// ...

Whenever logIn and logOut are called the current user value will update making any dependencies render again.


userUser | undefinedAn instance of the User object, available after a user authenticates
anonymousUserAnonymousUser | undefinedAn instance of the AnonymousUser object, available when anonymous users are enabled
logIn(config: LoginConfiguration, options?: LoginOptions) => Promise<User | undefined>Authenticates the user with respect to your LoginConfiguration. Middleware can be applied here using the second argument LoginOptions.
logOut() => voidLogs the user out and clears the stored user property.
sidSlashID | undefinedA reference to the underlying SlashID object.
isLoadingbooleanA flag where true means the SDK is not yet ready.
isAuthenticatedbooleanA flag where true means the user has logged in, analogous to <LoggedIn>