Key Hooks
Most apps only ever need one hook: useAuth(). It
exposes the signed-in state, the current user, a token accessor, and sign-out.
Add useAuthFetch() when you call your own
backend. Everything else is specialized; reach for it only when you build
custom account UI beyond the drop-in components.
Common flows
Section titled “Common flows”| Hook | What it’s for |
|---|---|
useAuth() | The primary hook: isSignedIn, user, getToken(), signOut(), and the active language. Start here. |
useAuthFetch() | A fetch wrapper that attaches the bearer token and retries once on a 401. Use it for requests to your own API. |
When the defaults aren’t enough
Section titled “When the defaults aren’t enough”These back the account widgets; use them directly only when you’re building bespoke account screens:
useUser()/useUserProfile(): read and update the profile.useSessions()/useIdentities()/useEmailAddresses(): active sessions and linked OAuth accounts.useDataRequest()/useDeleteAccount(): GDPR data-export and account-deletion flows.- Credential & flow hooks: build your own sign-in, sign-up, password-reset, and account-security UI (
useSignIn,useSignUp,usePasswordReset, …), strongly preferred over calling the/_toriiAPI yourself since their logic hot-patches from our CDN. For headless org-invitation redemption, seeuseInvitationSignUp. See the custom flows guide. useOrganizations(): list, create, and switch the active organization for B2B/multi-tenant apps.useRuntimeStatus(): observe the SDK runtime load lifecycle (advanced, the cards already handle this).
Next steps
Section titled “Next steps”useAuth()reference: the full return shape and examples.- Key Components: the UI these hooks back.