# Linking Strategies

Learn how FusionAuth links a user from an Identity Provider to a FusionAuth user.

> For the index of this section of the site, see [llms.txt](https://fusionauth.io/docs/llms.txt)

A linking strategy decides how FusionAuth links a user from an Identity Provider to a user in FusionAuth. You choose the linking strategy in the **Linking strategy** field when you configure the Identity Provider.

![The Linking strategy field on the form to add an Identity Provider.](https://fusionauth.io/img/docs/screenshots/idp-linking-strategy.png)

Version

In FusionAuth `1.65.0` and later, you can change the linking strategy only while the Identity Provider is disabled. To change the linking strategy of an enabled Identity Provider, disable the Identity Provider, change the value, and enable the Identity Provider again.

## Compare Linking Strategies

The following table compares the linking strategies:

| Strategy | User must exist | User linked on | Use when |
| --- | --- | --- | --- |
| `Create a pending link` | Depends on the Application. See [Pending Link](#pending-link). | The user chooses the account | The Identity Provider shares an email address or username that differs from the user's FusionAuth account, and users know enough to link the accounts. |
| `Linking disabled` | Not applicable | Not applicable | You want to manage every link yourself with the Link API. Available in FusionAuth `1.37.0` and later. |
| `Anonymous link` | No | The Identity Provider's user Id | The Identity Provider shares neither a username nor an email address. |
| `Link on email. Create the user if they do not exist.` | No | Email address | The Identity Provider shares the user's email address, and users who don't exist in FusionAuth can have access. |
| `Link on email. Do not create the user if they do not exist.` | Yes | Email address | The Identity Provider shares the user's email address, and only users who exist in FusionAuth can have access. Provision those users beforehand. |
| `Link on username. Create the user if they do not exist.` | No | Username | The Identity Provider shares the user's username, and users who don't exist in FusionAuth can have access. |
| `Link on username. Do not create the user if they do not exist.` | Yes | Username | The Identity Provider shares the user's username, and only users who exist in FusionAuth can have access. Provision those users beforehand. |

Some Identity Providers don't return a username or an email address. For those Identity Providers, use a pending link or an anonymous link. Both strategies link the user without a username or email address from the Identity Provider.

Every linking strategy except `Anonymous link` can use a reconcile lambda. An anonymous link has no user information to pass to a lambda.

## Linking and Create Registration

**Linking strategy** and **Create registration** are related, but distinct, settings. **Linking strategy** decides how FusionAuth finds or creates the user from the information that the Identity Provider returns. **Create registration** decides whether FusionAuth registers the user for an Application. For more information, see [Applications and Overrides](https://fusionauth.io/docs/authentication/identity-providers/applications-and-overrides.md).

## Linking Strategy Examples

The following examples show each linking strategy on the FusionAuth hosted login pages. In each example, Richard logs in to the Pied Piper application through an Identity Provider named Hooli. The behavior is the same for a social Identity Provider, such as Facebook, and for an enterprise Identity Provider, such as an OpenID Connect or SAML v2 server. The [Identity Providers API](https://fusionauth.io/docs/apis/identity-providers.md) offers similar behavior.

### Disabled

Available since `1.37.0`

With `Linking disabled`, FusionAuth doesn't link users automatically. You create every link with the Link API, which gives you the most control over which users get a link.

The strategy requires the `identityProviderUserId`, the immutable Id of the user in the Identity Provider. Without access to that Id, the strategy may not work. For more information, see [Link a User](https://fusionauth.io/docs/apis/identity-providers/links.md#link-a-user).

### Pending Link

Use `Create a pending link` when a user's email address or username in the Identity Provider differs from the user's FusionAuth account. The user must remember the FusionAuth account to link the accounts.

Note

When the Application allows self-service registration, the pending link page offers Create a new user as well as Link to an existing user . Otherwise, the page offers only Link to an existing user , and the user must already exist in FusionAuth.

Richard has a FusionAuth account with the email address `richard@piedpiper.com`, and a Hooli account with the email address `richard@hooli.com`:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with `richard@hooli.com`.
3.  Hooli redirects Richard to FusionAuth.
4.  FusionAuth asks Richard to log in with a Pied Piper email address and password.
5.  Richard logs in with `richard@piedpiper.com`.
6.  FusionAuth links the FusionAuth account `richard@piedpiper.com` to the Hooli account `richard@hooli.com`.

![The FusionAuth login page asking a user to log in to link an account from an Identity Provider.](https://fusionauth.io/img/docs/lifecycle/authenticate-users/identity-providers/idp-linking-pending-link.png)

### Anonymous Link

Use `Anonymous link` when you don't want a full user account in FusionAuth. For the limits of an anonymous account, see [Anonymous Account Limitations](#anonymous-account-limitations).

#### Anonymous Link, IdP Provides Email

Richard has no FusionAuth account:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with `richard@hooli.com`.
3.  Hooli redirects Richard to FusionAuth.
4.  FusionAuth creates an account with no username or email address. The account isn't a full account.
5.  Richard can use Pied Piper, and FusionAuth issues a JWT. Richard can't use FusionAuth workflows such as forgot password.

![The Admin UI view of a user who linked anonymously.](https://fusionauth.io/img/docs/lifecycle/authenticate-users/identity-providers/idp-linking-anonymous-account.png)

#### Anonymous Link, IdP Returns No Email or Username

Richard has no FusionAuth account. The Identity Provider is the Hooli XYZ server, which doesn't return a username or an email address:

1.  Richard clicks Login With Hooli XYZ on the login page.
2.  Richard logs in with `richard@hoolixyz.com`.
3.  Hooli XYZ redirects Richard to FusionAuth.
4.  FusionAuth creates an account with no username or email address. The account isn't a full account.
5.  Richard can use Pied Piper, and FusionAuth issues a JWT. Richard can't use FusionAuth workflows such as forgot password.

#### Anonymous Account Limitations

A user with an anonymous account can log in to applications with the credentials from the Identity Provider. An anonymous account has no email address, so the user can't use the email workflows of FusionAuth, such as forgot password.

You can't modify an anonymous user through the FusionAuth APIs. A request to modify the user must include a username or an email address.

An anonymous link provides no information about the user, so `Anonymous link` can't call a reconcile lambda.

### Link on Email

The following strategies link on an email address:

*   `Link on email. Create the user if they do not exist.` creates a user when no matching account exists in FusionAuth.
*   `Link on email. Do not create the user if they do not exist.` doesn't create a user. When no matching account exists, the login fails. When a matching account exists, the login succeeds.

#### Link on Email, Matching Account Must Exist and Does

The Identity Provider uses `Link on email. Do not create the user if they do not exist.`. Richard has a FusionAuth account with the email address `richard@piedpiper.com`:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with the account `richard@piedpiper.com`.
3.  Hooli redirects Richard to FusionAuth, and the login succeeds.
4.  FusionAuth links the FusionAuth account `richard@piedpiper.com` to the Hooli account `richard@piedpiper.com`.

#### Link on Email, Matching Account Must Exist but Doesn't

The Identity Provider uses `Link on email. Do not create the user if they do not exist.`. Richard has no FusionAuth account:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with the account `richard@piedpiper.com`.
3.  Hooli redirects Richard to FusionAuth, and FusionAuth shows an error. Richard gets no access.

FusionAuth shows the following error page:

![The FusionAuth error page for a login when the linking strategy requires an existing user and none exists.](https://fusionauth.io/img/docs/lifecycle/authenticate-users/identity-providers/idp-linking-user-must-exist.png)

#### Link on Email, User Account Is Created If Needed

The Identity Provider uses `Link on email. Create the user if they do not exist.`. Richard has no FusionAuth account:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with the account `richard@piedpiper.com`.
3.  Hooli redirects Richard to FusionAuth.
4.  FusionAuth creates an account with the email address `richard@piedpiper.com`.
5.  FusionAuth links the new account to the Hooli account `richard@piedpiper.com`.

### Link on Username

The following strategies link on a username:

*   `Link on username. Create the user if they do not exist.` creates a user when no matching account exists in FusionAuth.
*   `Link on username. Do not create the user if they do not exist.` doesn't create a user. When no matching account exists, the login fails. When a matching account exists, the login succeeds.

#### Link on Username, Matching Account Must Exist and Does

The Identity Provider uses `Link on username. Do not create the user if they do not exist.`. Richard has a FusionAuth account with the username `richard`:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with the account `richard`.
3.  Hooli redirects Richard to FusionAuth, and the login succeeds.
4.  FusionAuth links the FusionAuth account `richard` to the Hooli account `richard`.

#### Link on Username, Matching Account Must Exist but Doesn't

The Identity Provider uses `Link on username. Do not create the user if they do not exist.`. Richard has no FusionAuth account:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with the account `richard`.
3.  Hooli redirects Richard to FusionAuth, and FusionAuth shows an error. Richard gets no access.

#### Link on Username, User Account Is Created If Needed

The Identity Provider uses `Link on username. Create the user if they do not exist.`. Richard has no FusionAuth account:

1.  Richard clicks Login With Hooli on the login page.
2.  Richard logs in to Hooli with the account `richard`.
3.  Hooli redirects Richard to FusionAuth.
4.  FusionAuth creates an account with the username `richard`.
5.  FusionAuth links the new account to the Hooli account `richard`.

Related

[Authentication Identity Providers, Applications, and Overrides Learn how Identity Providers work with Applications, CIMD clients, and Application-specific overrides. idpidentity providercreate registration](https://fusionauth.io/docs/authentication/identity-providers/applications-and-overrides.md)

[Authentication Attribute Mappings Learn how to map claims from an Identity Provider response to FusionAuth user and registration fields without a lambda. idpidentity provider](https://fusionauth.io/docs/authentication/identity-providers/attribute-mappings.md)

[Authentication Identity Provider Hints Learn how to send users from the hosted login pages straight to an Identity Provider with the idp\hint and login\hint parameters. idpidentity provider](https://fusionauth.io/docs/authentication/identity-providers/hints.md)

[Authentication Identity Provider Scope Learn about global and tenant-scoped Identity Providers, and how to limit the links that each user can have to an Identity Provider. idpidentity provider](https://fusionauth.io/docs/authentication/identity-providers/identity-provider-scope.md)
---

## Other pages in Identity Providers

> For the full index of this section, see [Authentication](https://fusionauth.io/docs/llms-authentication.txt).

- [Identity Providers, Applications, and Overrides](https://fusionauth.io/docs/authentication/identity-providers/applications-and-overrides.md): Learn how Identity Providers work with Applications, CIMD clients, and Application-specific overrides.
- [Attribute Mappings](https://fusionauth.io/docs/authentication/identity-providers/attribute-mappings.md): Learn how to map claims from an Identity Provider response to FusionAuth user and registration fields without a lambda.
- [Add a SAML v2 with ADFS IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/adfs.md): Configure SAML v2 for Active Directory Federation Services (ADFS).
- [Add an OpenID Connect with Azure AD IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/azure-ad-oidc.md): Set up user login using Azure AD/Microsoft Entra ID as an OpenID Connect Identity Provider.
- [Add a SAML v2 with Azure AD IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/azure-ad-saml.md): Learn how to configure Azure AD (Microsoft Entra ID) as a SAML v2 Identity Provider for FusionAuth.
- [Add a OpenID Connect with Cognito IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/cognito.md): Set up user login using Cognito as an OpenID Connect Identity Provider.
- [Add a HYPR IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/hypr.md): Set up user login with HYPR using the HYPR Identity Provider.
- [Add an OpenID Connect with Okta IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/okta-oidc.md): Learn how to set up user login using Okta as an OpenID Connect Identity Provider.
- [Add a SAML v2 IdP-Initiated with Okta IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/okta-samlv2-idp-initiated.md): Configure SAML v2 IdP-Initiated SSO With Okta.
- [Add a SAML v2 with Okta IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/okta-samlv2.md): Configure SAML v2 for Okta.
- [Add a SAML v2 IdP-Initiated IdP](https://fusionauth.io/docs/authentication/identity-providers/enterprise/samlv2-idp-initiated.md): Learn how to let users log in to FusionAuth through a SAML v2 IdP-initiated Identity Provider.
- [External JWT IdP Example Usage](https://fusionauth.io/docs/authentication/identity-providers/external-jwt/example.md): Learn how to federate identity using the External JWT Identity Provider.
- [Add an External JWT IdP](https://fusionauth.io/docs/authentication/identity-providers/external-jwt.md): Learn how to configure an External JWT Identity Provider so FusionAuth can log in users with JWTs from a third-party identity provider.
- [Add an OpenID Connect with Discord IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/discord.md): Learn how to add a Login with Discord button to the FusionAuth login pages with the OpenID Connect Identity Provider.
- [Add an Epic Games IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/epic-games.md): Learn how to add an Epic Games login button to the FusionAuth login pages.
- [Add a Nintendo IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/nintendo.md): Learn how to add a Nintendo login button to the FusionAuth login pages.
- [Add a Sony PlayStation Network IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/sony.md): Learn how to add a Sony PlayStation Network login button to the FusionAuth login pages.
- [Add a Steam IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/steam.md): Learn how to add a Steam login button to the FusionAuth login pages.
- [Add a Twitch IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/twitch.md): Learn how to add a Twitch login button to the FusionAuth login pages.
- [Add an Xbox IdP](https://fusionauth.io/docs/authentication/identity-providers/gaming/xbox.md): Learn how to add an Xbox login button to the FusionAuth login pages.
- [Identity Provider Hints](https://fusionauth.io/docs/authentication/identity-providers/hints.md): Learn how to send users from the hosted login pages straight to an Identity Provider with the idp_hint and login_hint parameters.
- [Identity Provider Scope](https://fusionauth.io/docs/authentication/identity-providers/identity-provider-scope.md): Learn about global and tenant-scoped Identity Providers, and how to limit the links that each user can have to an Identity Provider.
- [Add an Identity Provider (IdP)](https://fusionauth.io/docs/authentication/identity-providers.md): Learn how to let users log in through an external identity provider such as Google or Okta.
- [Managed Domains](https://fusionauth.io/docs/authentication/identity-providers/managed-domains.md): Learn how managed domains connect email domains to an Identity Provider.
- [Add an OpenID Connect IdP](https://fusionauth.io/docs/authentication/identity-providers/overview-oidc.md): Learn how to let users log in to FusionAuth through an external OpenID Connect Identity Provider.
- [Add an External SAML v2 IdP](https://fusionauth.io/docs/authentication/identity-providers/overview-samlv2.md): Learn how to let users log in to FusionAuth through an external SAML v2 Identity Provider.
- [Add an Apple IdP](https://fusionauth.io/docs/authentication/identity-providers/social/apple.md): Learn how to add a Sign in with Apple button to your application.
- [Add a Facebook IdP](https://fusionauth.io/docs/authentication/identity-providers/social/facebook.md): Learn how to add a Login with Facebook button to your application.
- [Add a Github IdP](https://fusionauth.io/docs/authentication/identity-providers/social/github.md): Set up user login using Github as an OpenID Connect Identity Provider.
- [Add a Google IdP](https://fusionauth.io/docs/authentication/identity-providers/social/google.md): Learn how to add a Login with Google button to your application.
- [Add a LinkedIn IdP](https://fusionauth.io/docs/authentication/identity-providers/social/linkedin.md): Learn how to add a Sign in with LinkedIn button to your application.
- [Add a Twitter/X IdP](https://fusionauth.io/docs/authentication/identity-providers/social/twitter.md): Learn how to add a Login with Twitter/X button to your application.
