Beta

Create a tenant

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

Diagnosing sign-in failures

A sign-in can fail at any of its stages, and each stage leaves different evidence. This lesson follows three customers' failures at the collage app, before the ID token, at ID token validation and in a sign-in loop, and finds each one from the stage where it stopped.

Finding the stage

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

On Monday morning, the collage app's support queue has three new messages. The first customer says that Continue with your photo account shows an error page at the photo service. The second says sign-in worked last week, but now it returns them to the collage app with "We couldn't sign you in." The third says the screen keeps flickering between the two sites until the browser gives up.

All three are sign-in failures, and each stopped somewhere different. Diagnosing them starts with finding where.

A sign-in passes through its stages in a fixed order, and each leaves different evidence behind:

StageWhere the person ends upWhat the collage app can know
The requestOn the provider's error pageThe redirect URI, scopes, and other parameters it sent
At the providerStill at the providerOnly that the pending attempt was never completed
The callbackBack at the collage app, with an errorWhether a pending attempt matched, the iss received, and any error code
The token exchangeBack at the collage app, with an errorThe HTTP status and error code from the token endpoint
ID token validationBack at the collage app, with an errorThe failing check, the issuer, the kid, and the token's times
Account and sessionSigned in to the wrong account, or not for longThe issuer and subject looked up, and whether the session cookie came back

No single party sees the whole sign-in. The browser sees the redirects and which cookies it sends, the photo service knows what it accepted and issued, and the collage app knows whether a callback matched a pending attempt, what its checks decided, and whether a session started. So the method is to walk the stages in order and find the last one that succeeded: the failure lies in the stage after it, and that stage's own evidence says why. The Troubleshooting lesson Finding the failing stage applies the same method to failures of every kind. For a sign-in, one reading needs care: a callback missing from the collage app's records means the browser never delivered one, not that the photo service refused it. The records are only as useful as the fields When validation fails listed: the stage, the failing check, the issuer, the key identifier, and a correlation ID, never the code or the tokens.

Before the ID token

The first customer never came back to the collage app, so the failure is at the first stage. The collage app's records agree: an attempt created at 08:02 for this customer, never claimed, expired ten minutes later. The only thing the collage app controlled was the request it sent, so the support engineer compares the redirect_uri in that request with the addresses registered at the photo service, character by character:

sent:        https://www.collage.example/signin/callback
registered:  https://collage.example/signin/callback

The customer had arrived on www.collage.example, and a release on Friday had started building the return address from the host of the incoming request instead of from configuration. The photo service compares redirect URIs exactly, and it must not send anyone to an address it does not recognize, so it showed its own error page and sent nothing back. The repair is to take the return address from the collage app's configuration again. Registering the www address as well would make the error page go away, but it would not have saved the sign-in, for a reason that comes up again in the third case: the pending attempt's cookie belongs to the host that set it.

Other failures before the ID token look different. If the collage app comes back with an error from the token endpoint, invalid_client points at the collage app's own credentials, often a secret rotated on some servers and not others; the engineer compares which credential version each server uses, never the secret itself. invalid_grant points at the code: expired, already used, or sent with the wrong verifier or return address. And if the callback finds no pending attempt at all, the cookie that identifies the attempt did not come back with it. Three causes are common:

  • The attempt cookie is SameSite=Strict, or it is Lax while the provider uses form_post. A cross-site POST carries neither, as Response types, response modes, and older flows described.
  • The attempt started on www.collage.example, but the registered callback is on collage.example. A host-only cookie, such as one named with the __Host- prefix, is never sent to the other host.
  • The cookie expired while the person was at the provider, perhaps setting up a new authenticator, which took longer than the attempt's lifetime.

Each is repaired by restoring the binding between the browser and its attempt. Searching every stored attempt for one with a matching state would make the error disappear and remove the protection state exists for.

Rejected ID tokens

The second customer did come back, and the collage app rejected the ID token. Its record of the attempt says exactly which check failed:

{
  "time": "2026-10-05T08:14:07Z",
  "message": "Sign-in failed during ID token validation",
  "correlation_id": "corr-5521",
  "server": "app-3",
  "issuer": "https://auth.photos.example",
  "stage": "id_token_validation",
  "check": "iat",
  "kid": "photos-rs-2026-09",
  "token_iat": 1791188347,
  "server_time": 1791188047
}

The token says it was issued at 08:19:07, five minutes after the server's idea of now. Either the photo service's clock is five minutes fast or this server's is five minutes slow, and the other records decide which. Every failure of this kind comes from app-3, while the collage app's other servers accept the photo service's tokens all morning. Checked against a reliable time source, app-3 is five minutes behind: its time synchronization stopped after a restart. The customer was unlucky enough to be served by it twice.

The repair is the clock. Widening the collage app's clock tolerance to ten minutes would let these sign-ins through and hide the drift, and it would weaken the time checks on every server, as Expiration and nonce checks explained. Once app-3 is synchronized, a fresh sign-in routed to it succeeds, and the same token arriving ten minutes late is still refused.

The other rejections read the same way, from the check that failed. An unknown kid is often an ordinary rotation: the collage app refetches the photo service's key set from its jwks_uri, within a limit, and the sign-in succeeds. If the new key set still lacks the key, the token was signed by something the collage app does not trust, and the collage app never fetches a key from an address the token itself names. A nonce mismatch can be a replay, or a bookkeeping bug that pairs one attempt's callback with another attempt's nonce when a customer opens two tabs; the engineer checks that each state resolves to its own nonce and verifier. A genuine token with the wrong audience is still a rejection, whatever caused it, and removing the audience check is never the fix.

Sign-in loops

The third customer's screen flickered between the two sites. In a loop, each round trip ends in an answer and the collage app immediately asks again. The collage app's records for this customer show the pattern every second or two: callback matched, ID token valid, account found, session started, and then a request for the order page with no session cookie, which sends the browser back to sign in. The photo service still has a session, so it answers at once, and the cycle repeats.

The collage app is setting its session cookie, and the browser is not returning it. The response headers from the callback, read in the browser's developer tools without copying the cookie's value, show why:

Set-Cookie: __Host-collage-session=...; Domain=collage.example; Path=/; Secure; HttpOnly; SameSite=Lax

A cookie whose name starts with __Host- must be Secure, must have Path=/, and must have no Domain attribute. The same Friday release had added Domain=collage.example so that the session would reach www.collage.example too, and browsers refuse to store a __Host- cookie that names a domain. They do so silently, so the only symptom is a session that never arrives. Removing the attribute, and sending every customer to one host, ends the loop.

The other common loop does not show on screen. A silent prompt=none check, made to find out whether Ava is still signed in at the photo service, can return login_required because no usable provider session reaches that request. That is an answer, not an error to retry. A collage app that sends the same silent request again at once loops in the background, and the photo service sees a stream of identical requests. The collage app treats the answer as final, offers Ava a Sign in button, and asks again only after something changes, such as her choosing to sign in.

Each repair is proved in both directions: a fresh attempt through the repaired path reaches the session, and the check that failed still refuses what it should.

Check your understanding

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

Customers see an error page at the photo service, and the collage app's records show sign-in attempts that expire without any callback. Where should you look first? 1 of 3

Choose one answer.

Sign-ins fail on one of the collage app's servers because tokens appear to be issued five minutes in the future. What is the right fix? 2 of 3

Choose one answer.

After a release, Ava's sign-ins to the collage app flicker between the two sites. Each callback validates and starts a session, but the next request arrives without the session cookie. What is a likely cause? 3 of 3

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