Beta

Create a tenant

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

Login hints

A relying party often has a good idea which account a sign-in is for. It can pass that guess to the provider as a login hint, or point at the exact person with an earlier ID token. Either way, the hint shapes what the provider shows, and the validated ID token still decides who signed in.

Suggesting an account

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

The collage app emails Ava: the proof of her poster is ready to review. She opens the link on her phone, where she has never signed in to the collage app, so it needs her to sign in with her photo account before it shows the proof. Unlike a visitor arriving at its home page, this visitor is someone the collage app can make a good guess about. The proof belongs to her collage account, and that account holds her email address, [email protected]. The collage app can pass that guess along, so the photo service doesn't have to start from nothing.

It adds a login hint to the authorization request:

https://auth.photos.example/authorize
  ?response_type=code
  &client_id=photo-collage
  &redirect_uri=https%3A%2F%2Fcollage.example%2Fsignin%2Fcallback
  &scope=openid%20profile%20email
  &state=demo-signin-5
  &nonce=demo-nonce-5
  &code_challenge=yifcz29Q4ncDY9kb-79GH-Lwj3XpnDAY0NdoxWaKkJI
  &code_challenge_method=S256
  &login_hint=ava%40mail.example

login_hint tells the photo service which login identifier Ava is likely to use. If it has no session for her in her phone's browser, its sign-in page can open with [email protected] already filled in, and she goes straight to her password or passkey. If the browser is signed in to more than one photo account, the hint lets the photo service pick hers instead of showing the account chooser from Prompt and account selection, or picking whichever account was used last.

What a hint may contain is up to the provider. An email address is the most common form, and the specification also allows a phone number written the way the phone_number claim writes it. Some providers accept their own usernames, and some accept the subject identifier they issued. The specification leaves the use of the hint entirely to the provider, so the collage app follows the photo service's documentation rather than assuming.

An email address in a URL deserves a second thought. The request travels through Ava's browser, so the address is saved in her browser history and can appear in any log that records full URLs. The photo service already knows her address, so the hint tells it nothing new, but the collage app sends one only when it saves her real effort. Where a provider accepts the subject identifier, that value reveals less to anyone else who sees the URL. Pushed authorization requests, covered in Pushing an authorization request in Advanced OAuth, keep parameters like this out of the browser altogether: the client sends them to the provider directly, and the browser carries only a reference.

Hinting with an earlier ID token

An email address is a guess about what Ava might type. When the collage app holds an ID token from her current session, it can be exact. The id_token_hint parameter carries an ID token the photo service issued earlier, and tells the photo service that this request concerns the person that token names.

On her phone the collage app had no token to send. On the family laptop it does: it signed Ava in there this morning and keeps the ID token from that sign-in on its server with her session, as Establishing an application session described. Later today it will need to send her back to the photo service while that session is still active, for a reason Session age and reauthentication explains. Whatever the reason, the answer must be about Ava, not about whoever happens to be signed in to the photo service in that browser at the time.

So the request carries one more parameter. The token is shortened here:

&id_token_hint=eyJhbGciOiJSUzI1NiIsImtpZCI6InBob3Rvcy1ycy0yMDI2LTA5IiwidHlwIjoiSldUIn0...

The photo service reads the token's subject, user-2048, and compares it with its own session. If Ava is signed in as that account, or signs in as it during the request, the result is an ordinary sign-in. Otherwise the photo service must return an error, such as login_required, rather than a sign-in for someone else.

Suppose Ben, who shares the laptop, signed in to his own photo account in another tab. Without the hint, a silent request from the collage app could come back as a perfectly valid sign-in for Ben. With it, the photo service knows Ben is not the person the collage app is asking about. This matters most with prompt=none, where nobody sees a page that might reveal the mismatch. The specification asks clients to send id_token_hint with prompt=none whenever they have one, and allows a provider to refuse a silent request that arrives without it, although it should answer if it can.

Suggests Ava, Ben signs in

Request carries
login_hint for Ava
Signed in
Ben, after clearing the form
Photo service returns
Ben's sign-in
Collage app uses
Ben's validated sub

Ben gets his own account

Ava still signed in

Request carries
prompt=none, Ava's ID token
Signed in
Ava
Photo service returns
A code for user-2048
Collage app uses
Ava's validated sub

Silent sign-in for Ava

Ben signed in instead

Request carries
prompt=none, Ava's ID token
Signed in
Ben
Photo service returns
login_required
Collage app uses
No sign-in

Nothing about Ben

The same silent request

Request carries
prompt=none only
Signed in
Ben
Photo service returns
A valid sign-in for Ben
Collage app uses
Ben's sub, for Ava's session

The wrong person

The validated ID token decides who signed in, never the hint.

The same browser, four requests: a login hint only fills in the form, while an earlier ID token keeps a silent answer from being about Ben.

A few details make this work. The token's exp passed hours ago, and that is fine: the specification asks only for an ID token the provider issued earlier, because the collage app is not presenting it as proof of a current sign-in, only as a pointer to the person it names. The photo service doesn't need to appear in the token's audience either, which is just as well, because the token was addressed to the collage app. It does need to be a token the photo service itself signed for this client; one from another provider, or for another app, is refused. And the token travels through the browser like the rest of the request. The collage app's ID tokens carry no profile claims, so little beyond Ava's subject identifier is exposed. A token full of profile claims would put all of them in the URL.

Hints are not authority

A hint changes what the photo service shows. It changes nothing about what it takes to sign in. Anyone can put any email address in a URL, so the photo service authenticates the person in front of it exactly as it would without a hint. A provider that skipped the password because a hinted account looked right would let anyone sign in as anyone.

The same caution applies on the way back. The collage app's evidence of who signed in is the validated ID token, never the hint it sent. On her phone, Ava could clear the prefilled address and sign in with another account, and the photo service may ignore a login_hint altogether, as the specification allows. Either way, the collage app reads iss and sub from the validated token and looks up the account that pair belongs to.

That leaves the collage app with a decision when the result is not the account it expected. The proof belongs to user-2048. If the sign-in comes back for Ben's subject, the collage app signs Ben in to his own collage account, if he has one, and doesn't show him Ava's proof. It can say that the poster belongs to another account and offer to sign in again.

When the hint came from an active session, a different subject is more serious. Before a sensitive change, the collage app sends id_token_hint because it needs the person who owns the session to prove themselves again. A sign-in by anyone else, however valid, is not that, so the collage app discards whatever change was waiting rather than applying it to Ava's account.

Check your understanding

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

The collage app sends [email protected], but at the photo service Ben clears the form and signs in with his own account. The ID token validates. What should the collage app rely on? 1 of 3

Choose one answer.

Why should the collage app send id_token_hint with a prompt=none request when it holds Ava's earlier ID token? 2 of 3

Choose one answer.

The collage app sends an ID token that the mail service issued for Ava as id_token_hint to the photo service. What should the photo service 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