Unlink an identity from a user
Unlinks an identity from a user by deleting it. The user will no longer be able to sign in with that identity once it's unlinked.
- The Enable Manual Linking option must be enabled from your project's authentication settings.
- The user needs to be signed in to call
unlinkIdentity()
. - The user must have at least 2 identities in order to unlink an identity.
- The identity to be unlinked must belong to the user.
Parameters
identity
REQUIRED
UserIdentityuser_id
REQUIRED
stringprovider
REQUIRED
stringidentity_id
REQUIRED
stringid
REQUIRED
stringcreated_at
Optional
stringidentity_data
Optional
objectlast_sign_in_at
Optional
stringupdated_at
Optional
string
// retrieve all identites linked to a user
const identities = await supabase.auth.getUserIdentities()
// find the google identity
const googleIdentity = identities.find(
identity => identity.provider === 'google'
)
// unlink the google identity
const { error } = await supabase.auth.unlinkIdentity(googleIdentity)