Skip to main content
This hook requires the user to be authenticated.

Overview

useOAuthIdentities fetches the list of OAuth identities linked to the current user’s account and provides a function to unlink them. Use it to build a connected accounts settings page.

Usage Example

Returns

OAuthIdentity[]
Array of OAuth identities linked to the current user. Initially empty; call fetchIdentities to populate.
boolean
Whether the user has a password set. false for OAuth-only accounts, and until fetchIdentities has run. Use it to prompt the user to set an initial password (via useAuth().setPassword) before they unlink their last identity.
function
Async function that fetches the identities list from the server and updates local state. Returns void.
Async function that unlinks a specific identity. Accepts { identityId: string }. On success, removes the identity from the local identities array. Fails if it would be the last identity and the user has no password set.
boolean
true while a fetch or unlink request is in progress.
string | null
Error message from the most recent failed operation, or null if no error.

OAuthIdentity Type

See Also