Link an identity to a user
Links an oauth identity to an existing user. This method supports the PKCE flow.
- The Enable Manual Linking option must be enabled from your project's authentication settings.
- The user needs to be signed in to call
linkIdentity()
. - If the candidate identity is already linked to the existing user or another user,
linkIdentity()
will fail. - If
linkIdentity
is run in the browser, the user is automatically redirected to the returned URL. On the server, you should handle the redirect.
Parameters
credentials
REQUIRED
SignInWithOAuthCredentialsprovider
REQUIRED
ProviderOne of the providers supported by GoTrue.
options
Optional
objectqueryParams
Optional
objectAn object of query params
redirectTo
Optional
stringA URL to send the user to after they are confirmed.
scopes
Optional
stringA space-separated list of scopes granted to the OAuth application.
skipBrowserRedirect
Optional
booleanIf set to true does not immediately redirect the current browser context to visit the OAuth authorization page for the provider.
const { data, error } = await supabase.auth.linkIdentity({
provider: 'github'
})