|
1 | 1 | ---
|
2 |
| -title: Account Linking |
3 |
| -description: Learn how Clerk handles account linking and manages unverified email addresses from social providers. |
| 2 | +title: Account linking for OAuth |
| 3 | +description: Learn how Clerk handles account linking and manages unverified email addresses from OAuth providers. |
4 | 4 | ---
|
5 | 5 |
|
6 |
| -Account Linking is a process used by Clerk to ensure a smooth sign-in and sign-up experience using both OAuth and other methods (e.g. username/password). By using the "email address" as the common identifier, Clerk aims to merge accounts whenever possible. This mechanism is triggered when a social provider returns an email address that matches an existing account, assuming a single owner for each email address. |
| 6 | +Account linking is the process of connecting multiple user accounts from different services or platforms, allowing users to access various services with a single set of credentials. By using the email address as the common identifier, Clerk automatically attempts to link accounts whenever possible. Account linking is triggered when an OAuth provider returns an email address that matches an existing account, assuming a single owner for each email address. |
7 | 7 |
|
8 | 8 | ## How it works
|
9 | 9 |
|
10 |
| -When a user attempts to sign in or sign up, Clerk first checks the email address provided. If that email address comes from a social provider such as Google or Facebook, Clerk's behavior varies. It considers two main factors: the verification status of the email address, and whether an account with that email address already exists in Clerk's system. Based on these factors, Clerk will attempt to link the OAuth account with any existing Clerk account that shares the same email address. |
| 10 | +When a user attempts to sign in or sign up, Clerk first checks the provided email address. Clerk will attempt to link the OAuth account with any existing Clerk account that shares the same email address. |
11 | 11 |
|
12 | 12 | In the following sections, we'll look at the different scenarios that can occur during this process and explain how Clerk handles each one.
|
13 | 13 |
|
14 | 14 | 
|
15 | 15 |
|
16 | 16 | ### Email address is verified in both OAuth and Clerk
|
17 | 17 |
|
18 |
| -In this scenario, when a user with a verified email address signs in using a social provider that returns a matching verified email address, Clerk links the OAuth account to the existing account and signs the user in. This even applies to password-protected accounts, as the OAuth sign-in process automatically bypasses password verification. |
| 18 | +When a user signs in to your app using an OAuth provider that returns a **verified** email address, Clerk links the OAuth account to the existing account and signs the user in. This even applies to password-protected accounts, as the OAuth sign-in process automatically bypasses password verification. |
19 | 19 |
|
20 | 20 | ### Email address is verified in Clerk but not in OAuth
|
21 | 21 |
|
22 |
| -In this scenario, when a user with a verified email address at Clerk signs in using a social provider that returns a matching but unverified email address, Clerk will initiate a verification process. Once the email address is verified, the OAuth account is linked to the existing one, and the user is signed in. |
| 22 | +When a user signs in to your app using an OAuth provider that returns an **unverified** email address, Clerk will initiate a verification process. Once the email address is verified, the OAuth account is linked to the existing one, and the user is signed in. |
23 | 23 |
|
24 |
| -### Email address is not verified in Clerk and not in OAuth |
| 24 | +### Email address is unverified in Clerk |
25 | 25 |
|
26 |
| -For instances that allow account creation without email verification at sign-up, there is a possibility that an account may be created using an unverified email address, either through OAuth or other methods like username/password. |
| 26 | +By default, users are required to verify their email addresses before they can sign up. |
27 | 27 |
|
28 |
| -To allow unverified email addresses for your instance, navigate to the [**Email, phone, username**](https://dashboard.clerk.com/last-active?path=user-authentication/email-phone-username) page in the Clerk Dashboard. Select the settings icon next to "Email address" and uncheck the "Verify at sign-up" toggle. |
| 28 | +If you disabled the **Verify at sign-up** option in the [Clerk Dashboard](https://dashboard.clerk.com/last-active?path=user-authentication/email-phone-username), users will be able to sign up without verifying their email addresses. |
29 | 29 |
|
30 |
| - |
31 |
| - |
32 |
| -Clerk initiates the email verification process at the outset. Upon successful email verification, regardless of the method, additional steps may be taken to validate existing connections or passwords. This is done to ensure the user's account remains secure. |
| 30 | +When a user signs up with an **unverified** email address and later attempts to sign in with an OAuth provider, Clerk implements security measures to prevent potential account takeovers. For example, if an account was created with an unverified email/password combination and the user later signs in with Google (where the email is verified), Clerk will prompt the user to change their password before linking the accounts. This process begins with email verification, regardless of the method used. After successful verification, Clerk may require additional steps, such as validating existing connections or passwords, to ensure the account's security. These measures are in place because Clerk cannot confirm the original ownership of the account, which could otherwise lead to unauthorized access. |
33 | 31 |
|
34 | 32 | ## Users with different email addresses
|
35 | 33 |
|
36 |
| -If a user has a different email from the one associated with the OAuth account, they can manually associate the two. To do so, they must: |
| 34 | +If a user has a different email from the one associated with the OAuth account, they can manually associate the two by following these steps: |
37 | 35 |
|
38 |
| -1. Sign into their Clerk application with the account that uses their main email address. |
39 |
| -1. In the **Manage Profile** section of the [`<UserProfile />`](/docs/components/user/user-profile) page, add the different email. |
| 36 | +1. Sign in to their Clerk application with the account that uses their main email address. |
| 37 | +1. In the [`<UserProfile />`](/docs/components/user/user-profile), add the different email. |
40 | 38 |
|
41 | 39 | After following these steps, the user's OAuth accounts associated with both their primary and added email addresses will be linked to their main account.
|
0 commit comments