Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Linking accounts

Linking lets a provider sign-in open an account that already exists. Every link is a new way into that account, so the relying party asks for proof of control on both sides, never just a matching email address, and treats removing a link with nearly the same care.

Two ways into one account

All domains, identifiers and tokens in these examples are fictional.

Ava opened her collage app account in November 2025, long before the app offered a photo sign-in. It is account 8812, registered with [email protected] and a password, and it holds her collages, her past print orders and her delivery address. So when the registration page asks whether to create a new account or connect an existing one, she chooses to connect.

The collage app can see that the email address the photo service reported, [email protected], is the address on account 8812. Linking the two on that basis alone would be easy. Trust across systems showed why the shortcut fails when a provider never checks addresses. The harder cases are the ones where the provider did check.

Linking adds a row to the sign-in identities table for an account that already exists: the pair https://auth.photos.example and user-2048, pointing at account 8812. Afterward, either Ava's password or her photo account opens the same account, with the same collages and addresses. Later she might link her mail service account as a third way in, with its own row for https://accounts.mail.example and a94f1c07e2.

Every row is a way into the account, so adding one is the same kind of change as enrolling a new security key. Enrollment, replacement, and recovery set the rule for that: a new way in needs proof from the person who already controls the account, and knowing its email address is not proof. Whoever links has to show control of both sides, the photo account through the validated ID token and account 8812 through its own sign-in.

Why matching emails is not enough

Suppose the collage app linked automatically whenever a sign-in arrived with email_verified set to true and an address matching an existing account. Each of these situations would then give an account to the wrong person:

Three ways a matching, verified email address links the wrong person
SituationWhat the collage app seesWhat actually happened
Someone registered firstA verified photo sign-in for [email protected], and a collage app account with that addressBefore Ava ever used the collage app, someone else registered [email protected] there with a password of their own. Nobody confirmed the address, and the app kept the account anyway.
The address was reassignedA verified mail service sign-in for [email protected]Ava stopped using the address, and the mail service later gave it to someone new, under a different subject.
The verification is old or weakA photo sign-in with email_verified set to trueThe provider checked the address once, years ago, by a process the collage app has never assessed.

The first case is known as account pre-hijacking, and it surprises people because nothing about the photo sign-in is wrong. Ava signs in with her photo account, the collage app links her to what looks like her account, and she adds a delivery address and a card. The person who created the account still knows its password. They sign in whenever they like and see everything she added. The collage app joined a genuine sign-in to an account whose owner it had never established.

The defense starts with the collage app's own records. An account whose address the app never confirmed has no owner it can name, so it is never a candidate for linking. The flow below would have stopped Ava anyway, by asking for a password she never set. Resetting that password through her mailbox would then give the account to whoever controls the address, which is Ava, and should end every session its creator still had.

The second case is the reuse Claim stability and privacy warned about. The new holder of the address has their own subject at the mail service, so nothing but the email connects them to account 8812, and only email matching would let them in.

The mail service is a closer call, because it runs mail.example. Its verification describes a mailbox it operates, which is stronger evidence than another provider can offer. It still says nothing about who created the collage app account with that address, and it is the very provider that can give the address to someone else, so the collage app asks for proof here too.

A safe linking flow

Ava's path through the collage app shows the safe version. Both sides are authenticated in the same browser session before anything is written:

  1. The photo side. Her photo sign-in completed normally, with state, the nonce and the full ID token validation. The validated pair waits in the pending registration attached to her session.
  2. The collage app side. She chooses to connect an existing account, and the app asks her to sign in to it with its own method: her password, and the second factor if she has enrolled one. The account to be linked is the one this sign-in proves, not one picked by the email match or named in a form field.
  3. A check for conflicts. The app confirms that the pair isn't already linked to a different account. If it were, the app would stop and explain rather than move it, because moving a way in from one account to another needs proof for both accounts.
  4. Confirmation. The app says plainly what will happen: allow the photo account Ava Archer, [email protected], to sign in to this collage app account. Her answer is a POST from the app's own page, protected against cross-site requests.
  5. The record. In one transaction, the app inserts the identity row and an audit entry recording the account, the issuer and subject, the time, and how each side was authenticated.
  6. Notice. It emails the address it confirmed for account 8812, which need not be the address the photo service reported, and lists the photo account under Sign-in methods with a Remove button.
The photo service proves one side and the collage app's own sign-in proves the other, both in the same browser session. Only then does the app ask Ava to confirm and write the link.

Starting from the other side works the same way. If Ava were already signed in with her password and chose Link photo account under Sign-in methods, the app would ask for the password again unless she had just entered it, then start a new authentication request with fresh state, nonce and PKCE values. The pending attempt records that it is for linking, and the account to link comes from her session, never from anything in the request.

Request correlation and CSRF showed an attacker delivering a callback for their own photo account into someone else's browser. Against a linking flow, success would give the attacker's photo account a permanent way into Ava's collage app account. The session-bound state and the nonce stop that forged callback. The confirmation is a second barrier, since no link is created without Ava seeing which photo account is being added, and the notice tells her if one was created anyway.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

A photo sign-in arrives with [email protected] and email_verified set to true. An existing collage app account uses the same address. What should the app do? 1 of 3

Choose one answer.

Someone registered a collage app account with Ava's email address before she ever used the app, and never confirmed it. Later the app links her photo sign-in to that account because the addresses match. What can go wrong? 2 of 3

Choose one answer.

Ava signed up through the photo service and never set a password. She asks the collage app to remove her photo sign-in. What should the app do? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity