Beta

Create a tenant

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

When validation fails

Rejecting a token that fails validation is right, but it is only the start. Someone has to work out what kind of failure it is, tell the people affected something useful without helping an attacker, and repair the cause without turning the repair into a new weakness.

Sorting the failures

At 09:12 on a Tuesday, the collage company's support team receives a message: "Continue with your photo account just brings me back to the sign-in page." By 09:30 there are forty more. Behind each one is a sign-in whose ID token the collage app rejected, and the collage app did what Validating an ID token required of it. It signed nobody in.

All domains, identifiers and log values in these examples are fictional.

The collage app's records show where each sign-in stopped, and the pattern across them says where to look first. It does not say who caused the failures. A nonce mismatch can come from two sign-ins overlapping in one browser, or from the collage app storing its attempts badly. An unknown key can follow a legitimate rotation, a failed fetch, or a token from a provider the collage app never configured. Finding the failing stage in general is taught in Finding the failing stage; here the stage is already known, because validation stopped the sign-in. What remains is which check failed, what the collage app compared the token against, and how that differs from a sign-in that worked. The usual answers fall into four kinds:

KindWhat the pattern looks likeCommon causes
Configuration mismatchEvery sign-in fails at the same check, starting at a release or a change at the provider.An issuer with a trailing slash, a test client ID in production, an algorithm the provider has moved to that the list lacks, a key set address from the wrong environment.
Clock problemsTime checks fail: tokens look expired on arrival, or issued in the future. Often only some servers are affected.A server whose clock has drifted, or a virtual machine resumed with a stale clock.
Key set unavailableA token names a key the collage app does not hold, and fetching the set fails or times out.A network or firewall change, an outage at the provider, a rotation the collage app could not follow.
Scattered validation failuresFailures at the signature, audience, or nonce checks, with no known deployment change.A replayed or altered token, a bug that mixes up two attempts, or a configuration change nobody noticed. Any of them is possible, so the team investigates before naming one.

Tuesday's failures were all at the audience check, and they began at 09:10, two minutes after a release. That pattern points at configuration, and so it proved. The release had upgraded the collage app's OpenID Connect library, and the new version read the expected audience from a setting with a new name. With its old setting ignored, the library had no expected audience at all. As Validating an ID token asked of it, the library rejected every token rather than skip the check, while the photo service, correctly, kept sending photo-collage.

The other kinds leave their own traces. Clock faults come and go with the server that handled each request, and the gap between the token's times and the server's clock is about the same each time. Key set failures arrive alongside errors from the fetch itself. They also call for a decision made in advance. If a token names a key the collage app already holds, from a set it fetched recently, the collage app can keep validating with that copy while the provider recovers. If the key is unknown and the set cannot be fetched, the collage app has no way to verify the token, so the sign-in fails.

The repair was to give the library its expected audience under the new setting's name, check it against the collage app's registration for production, and try a fresh sign-in. Accepting more audiences would not have helped: the tokens were already addressed to the collage app.

What the person sees

From the person's side, all four kinds look the same, and they should. The collage app shows the page that Authentication errors described for any failed sign-in, with one addition, a reference:

We couldn't sign you in with your photo account.
Try again, or sign in another way.

Reference: signin-5f2c

Trying again starts a new attempt with a fresh state, nonce, and PKCE verifier. The failed attempt was claimed when the callback arrived, so nothing from it can be reused. The collage app does not retry by itself. An automatic retry can bounce a browser between the collage app and the photo service, and when the cause is configuration, every retry fails the same way.

The page does not say which check failed. "Nonce mismatch" or "invalid audience" means nothing to someone making a collage, and to someone testing forged tokens it reports how far each one got. The page shows nothing from the rejected token either. A name or email address inside a token that failed validation is unverified text, possibly written by an attacker, so "Welcome back, Ava" has no place here. The reference lets a person who contacts support be matched to the collage app's records without anyone reading out a token.

When the fault is the collage app's own, as on Tuesday, everyone sees the same page until the fix is deployed. A short notice on the sign-in page saying that sign-in with the photo service is having problems saves people from trying again and again.

What the logs record

Authentication errors set out the basics: the stage, the failed check, the expected issuer, and a correlation ID, and never the code or the tokens. A validation failure needs a few more fields to be diagnosable. One of Tuesday's entries:

{
  "time": "2026-10-06T09:12:04Z",
  "event": "sign_in.id_token_rejected",
  "message": "Sign-in rejected: the ID token failed the audience check",
  "stage": "id_token_validation",
  "check": "audience",
  "expected_issuer": "https://auth.photos.example",
  "expected_audience": null,
  "kid": "photos-rs-2026-09",
  "alg": "RS256",
  "token_age_seconds": 2,
  "server": "web-3",
  "correlation_id": "signin-5f2c"
}

The stage and check say where validation stopped. The expected values show what the collage app compared against, and on Tuesday they were the whole answer: anyone reading this entry could see that the collage app had no expected audience at all. The kid and alg come from the token's header and separate key problems from others. token_age_seconds, the server's time minus the token's iat, exposes a drifting clock, since a negative age means a token from the future. The server name shows whether failures follow one machine. The correlation ID is the reference the person saw, and it ties this entry to the callback and the token request before it.

What the entry leaves out matters as much. It never holds the ID token, the access token from the same response, the authorization code, or the state and nonce values. Logs are read by more people and kept longer than most of what the collage app stores, and the access token beside the ID token is a working credential. Ava's name and email address stay out too. When a value from the rejected token would genuinely help, such as the issuer it named when the issuer check failed, the collage app records it shortened and marked as unverified, because anyone can write anything into a token that has not passed.

Entries like this are most useful in aggregate. Counting failures by check, server, and provider each hour turns Tuesday into a single line on a graph that jumps two minutes after the release. A rise in signature or nonce failures with no release behind it is the signal that someone is trying tokens they should not have.

Fixes that make things worse

A sign-in outage invites quick fixes, and the quickest ones switch off the check that failed instead of correcting what it compared against:

Tempting fixWhat it actually doesFix instead
Turn off the audience checkAccepts ID tokens the photo service issued to any client, including the collage app.Set the expected audience to photo-collage.
Accept whatever algorithm the header namesBrings back unsigned tokens and the HMAC confusion attack.Confirm the provider's change, then add that one algorithm.
Widen the clock tolerance to an hourAccepts expired tokens for an hour and widens the window for replays.Repair the server's time synchronization.
Finish sign-ins whose pending attempt cannot be foundRemoves what state and the nonce protect against: forged callbacks, injected codes, and replayed tokens.Find out why the attempt is missing.
Use a key from the token when the key set is unreachableLets anyone sign a token with a key of their own and pass.Use the cached set, retry with limits, and fail the sign-in otherwise.

The missing-attempt row usually traces back to a cookie. Request correlation and CSRF followed a team whose callback stopped receiving its session cookie after a SameSite change. Without the attempt the cookie leads to, there is no state to match and no nonce to compare. The repair is the one that lesson gave for the cookie, not a callback that finishes without its attempt or searches every attempt for one that fits.

The most dangerous fix rarely looks like a decision at all. It is an error handler that records the failure and carries on, or a fallback that, when the ID token will not validate, asks the UserInfo endpoint who the access token belongs to. Authentication errors ruled out that fallback for a response with no ID token, and it is no safer for one whose ID token failed. UserInfo can describe whoever the access token belongs to, but it cannot prove that this response answers the collage app's own pending attempt. A failed validation ends the sign-in: the handler records a safe reason, discards the tokens, and creates no account link or session.

Check your understanding

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

After a release, every sign-in fails at the audience check. A developer suggests turning the check off until the cause is found. What is wrong with that? 1 of 2

Choose one answer.

Which of these belongs in the collage app's log entry for a rejected ID token? 2 of 2

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