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, 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 post-login.
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 and the user property is available.