AuthProvider

Authentication state management and hooks.

Props#

PropTypeDefaultDescription
childrentype ONLY_FOR_FORMAT = | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | PromiseLikeOfReactNode
onAuthStateChange( callback: AuthStateChangeCallback<TUser>, ) => UnsubscribeHandlerShould trigger whenever the authentication state changes
onGetToken() => Promise<AuthToken>Return the session token
onLoadUser() => Promise<TUser | null>Loads user data after authentication
onLogin( params: AuthParams, options?: AuthOptions<ExtraAuthOptions> | undefined, ) => Promise<TUser | null | undefined>The login method
onLogout( options?: AuthOptions<ExtraAuthOptions> | undefined, ) => Promise<unknown>The logout method
onResetPassword( params: Required<Pick<AuthParams, "email">>, options?: AuthOptions<ExtraAuthOptions> | undefined, ) => Promise<any>Request to reset a password.
onSignup( params: AuthParams, options?: AuthOptions<ExtraAuthOptions> | undefined, ) => Promise<TUser | null | undefined>The signup method
onUpdatePassword(params: Required<Pick<AuthParams, "password">>, options?: AuthOptions<ExtraAuthOptions> | undefined) => Promise<...>Update the password.
onVerifyOtp( params: OtpParams, options?: AuthOptions<ExtraAuthOptions> | undefined, ) => Promise<boolean | null | undefined>Verify an one time password (2fa)

Was this helpful?