Beta

Create a tenant

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

Connecting a sign-in to an account

A validated ID token says who the provider authenticated, but the relying party still has to decide which of its own accounts that sign-in opens. It builds that connection on the issuer and subject pair, keeps everything else as labeled copies, and gives each account an identifier of its own.

The first sign-in

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

Ava chooses Continue with your photo account on the collage app's sign-in page for the first time. A moment later the collage app has done everything described from Following a complete sign-in to The UserInfo endpoint. It has exchanged the code, validated the ID token and its nonce, and fetched her profile from the UserInfo endpoint. It knows that the photo service has just authenticated user-2048, and that the account's name is Ava Archer and its email address is [email protected].

What it doesn't know yet is which collage app account she means. Saved collages, print orders and delivery addresses all belong to collage app accounts, and the sign-in has to lead to one of them. Claim stability and privacy ended with the rule that decides how: of everything the photo service sends, only the issuer and the subject together identify her. The collage app builds its accounts on that pair.

The collage app keeps a table of sign-in identities, with one row for each provider account that may open a collage app account. It looks there for the pair from the validated ID token:

Issuer:  https://auth.photos.example
Subject: user-2048

There is no row. That tells the collage app only that this photo account has never been used to sign in here. It doesn't tell it that Ava is a new customer. She might have opened a collage app account with a password long before the photo button existed, and nothing in the ID token can distinguish those two situations.

A relying party can handle the missing row in two ways. It can create an account at once, using the claims as starting values, so the first sign-in feels like every later one. That is quick, but it creates accounts for people who were only looking around, and it adopts a name and address the person never reviewed. Or it can ask for registration details first: show a short form filled in from the claims, ask for anything the provider doesn't supply, such as agreement to the app's terms, and create the account only when the person confirms.

The collage app asks. Its registration page greets Ava Archer and offers two choices: create a new collage app account with the details shown, or sign in to an existing collage app account and connect this photo account to it.

While that page is open, the collage app has to remember who signed in. The validated issuer and subject stay on its server, in a pending registration attached to Ava's session:

Pending registration (expires 15 minutes after the sign-in)
  Issuer:   https://auth.photos.example
  Subject:  user-2048
  Claims:   name Ava Archer, email [email protected], email_verified true

The form carries only what Ava is allowed to choose. If the issuer and subject traveled in hidden form fields, the browser would send them back, and whoever submitted the form could put a different subject there and create an account tied to someone else's photo account. The identity has to come from the validated ID token, by a route the browser can't touch. If Ava abandons the page, the pending registration expires and nothing is created.

A new customer who chooses to create an account gets a new collage app account and a row linking it to their pair, written in one transaction so neither can exist without the other. Ava has had a collage app account since her first collage, so she chooses the second option instead. Linking accounts follows that path. Either way, the result is the same kind of row.

Returning customers

Once a row connects the pair to an account, every later sign-in is a lookup. The next time Ava signs in, the collage app reaches this point and runs:

SELECT account_id
  FROM sign_in_identities
 WHERE issuer  = 'https://auth.photos.example'
   AND subject = 'user-2048';

The row points to collage app account 8812, which is Ava's. No other claim takes part in finding it.

The comparison is exact. Both values are case-sensitive strings, so the collage app doesn't lowercase them, trim them, or treat User-2048 as the same subject. The issuer is the one the collage app configured for the photo service and validated the token against, compared character for character.

The table itself enforces the important rule:

CREATE TABLE sign_in_identities (
  account_id  TEXT NOT NULL REFERENCES accounts(id),
  issuer      TEXT NOT NULL,
  subject     TEXT NOT NULL,
  linked_at   TEXT NOT NULL,
  UNIQUE (issuer, subject)
);

UNIQUE (issuer, subject) means a pair can appear only once, so one photo account can never open two collage app accounts. The rule covers the pair, not the subject alone. When the collage app adds the mail service as a second provider, Ava's account there arrives with the subject a94f1c07e2, and as Supporting several providers pointed out, another provider is free to issue user-2048 to someone else entirely. A lookup by subject alone could hand that stranger Ava's account. Account 8812 can have several rows, one for each provider she links, and each row is checked on its own.

A lookup by email address would fail in the ways Claim stability and privacy described. If Ava changes her address at the photo service to [email protected], the pair still finds account 8812, and the collage app updates its copy of the address. A lookup by email would find nothing and offer her a second account, or find an account that now belongs to whoever has been given her old address.

Ava returns

Issuer
auth.photos.example
Subject
user-2048
Pair lookup
Account 8812
Email lookup
Account 8812

Both find her account

Ava changed her address

Issuer
auth.photos.example
Subject
user-2048
Pair lookup
Account 8812
Email lookup
Nothing found

The pair still finds her

New owner of her old address

Issuer
accounts.mail.example
Subject
A different subject
Pair lookup
No account: a new customer
Email lookup
Account 8812

Email would open her account

Only the issuer and the subject together identify her.

Three sign-ins, each looked up by the pair and by email. The pair follows Ava through an address change, and only an email lookup would hand her account to the new owner of her old address.

Two outcomes need more than a plain match. If the row points to an account the collage app has suspended or closed, a valid ID token doesn't reopen it: the provider vouches for who signed in, and the collage app still decides what that person may do. And if the lookup fails for people the collage app expects to recognize, for example after a provider moves to a new issuer identifier, or after a change of host alters pairwise subjects as Public and pairwise subject identifiers described, the collage app has a migration to plan. Falling back to matching email addresses is not a way to cover the gap.

What the account stores

After Ava's photo account is linked, a simplified view of the collage app's records for her looks like this:

Account 8812
  Display name:    Ava Archer
  Contact email:   [email protected] (confirmed by the collage app, 2025-11-14)
  Password:        set
  Collages, print orders and delivery addresses refer to 8812

Sign-in identities for account 8812
  https://auth.photos.example   user-2048   linked 2026-09-28 18:12 UTC

Profile copied from https://auth.photos.example
  name          Ava Archer
  email         [email protected]   (email_verified true)
  updated_at    1788220800         (2026-09-01 00:00 UTC)
  copied        2026-10-01 09:00 UTC

Three choices in that record matter.

The account has its own identifier. Collages, print orders and addresses all refer to account 8812, never to user-2048. If the collage app had used the subject as its account ID, Ava's account would effectively belong to the photo service: a second provider would need a second account, and removing the photo sign-in would strand her collages. Identity rows are ways into an account, and the account outlives any one of them.

The profile is a copy, labeled with where it came from. Ava entered her display name and contact email when she registered. The photo service's name and email sit beside them as statements it made at one moment; for a customer who signed up through the photo service, they would have supplied the starting values. Recording the source and the provider's updated_at claim, the time the provider last changed the profile, lets the collage app replace the copy when newer values arrive at a later sign-in, and keep apart what Ava typed, what the app confirmed itself and what it only received.

The contact email shows why that matters. The collage app sent its own confirmation link to [email protected] when Ava registered, and that confirmation, not the photo service's email_verified, is why it trusts the address for password resets. If the photo service later reports a different address, the collage app can offer to use it, and confirm it before relying on it for anything that could hand over the account.

And the record leaves things out. It holds no ID token, no UserInfo response and no access token. Those were evidence for one sign-in, and keeping them would only create something else to protect. The copied profile holds the claims the collage app actually uses and nothing more.

Check your understanding

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

Ava changes her email address at the photo service. The next time she signs in to the collage app with her photo account, how does the app find her account? 1 of 3

Choose one answer.

After Ava's first sign-in, the collage app shows a registration form and must remember the validated issuer and subject until she submits it. Where should it keep them? 2 of 3

Choose one answer.

The collage app adds the mail service as a second provider. Its sign-in identities table must stop one provider account from opening two app accounts. Which rule does that? 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