Finding the failing stage
To the person who reports it, a failed sign-in is one attempt. To you it is several stages run by different systems, and each stage leaves its own evidence. This lesson follows one report from the printing site to the photo service's APIAn application programming interface: a defined way for software to interact with a service. A web API offers endpoints where other programs send HTTP requests., finds the stage that failed, and repairs only that stage.
The preview will not open
All names, domains and identifiers in these examples are fictional. A support ticket arrives on a Tuesday afternoon: "I can't sign in to the printing site. I typed my password, it took me back to the site, and then it said We could not open your preview. I tried again and got the same thing." It comes from Mara, who orders photo books from a printing company that reads her albums from a separate photo service.
From Mara's side that was one attempt, and it failed. From your side it was at least four pieces of work done by three different systems, the stages of the authorization code flow. Her browser went to the photo service's sign-in page, where she proved who she was. The photo service sent her browser back to the printing site with an authorization codeA short-lived, single-use value that the authorization server sends back to a client through the browser. The client swaps it for tokens in a direct request to the authorization server; APIs never accept it.. The printing site's backend exchanged that code for an access tokenA token that a client presents to an API to use access it has been granted, usually limited in what it allows and how long it lasts. It authorizes API calls; it does not tell the client who signed in. at the photo service's token endpointThe authorization server address where clients exchange an authorization code, refresh token, or other grant for tokens, in a direct request rather than through a browser redirect.. Finally, the backend called the photo service's API for the album she wanted to print, with the tokenA piece of data issued by a trusted service that a client presents as a credential, for example to call an API or to report a sign-in. Some tokens carry readable claims; others are random strings that only the issuer can interpret. in its Authorization header. Any one of those can fail, and every one of them can end on the same friendly error page.
So the first job is to find out which piece of work failed, before you guess at a cause. Pin the attempt down first: who it was, which application and environment, roughly when, what should have happened, and whether it has ever worked. A staging site and the production site can look identical while using different clients, issuers and APIs, and an engineer who investigates the wrong one can spend an hour proving that production is fine. Ask Mara for the time and what she clicked. Don't ask her for her password, a screenshot of the address bar, or anything copied out of her browser's developer tools: an address bar can hold a live authorizationDeciding whether a requested action is permitted, such as whether a signed-in account may delete a particular photo. Authentication says which account is asking; authorization decides what it can do. code, and the developer tools show sessionThe ongoing connection between later requests and an earlier sign-in, so you are not asked for your password on every click. It is often tracked with a cookie holding an unpredictable session identifier. cookies.
Find the last successful step
Each stage of a sign-in leaves its own evidence, and each stage proves only itself. A correct password does not prove that a code reached the application. A code arriving does not prove that the exchange worked. A token in hand does not prove that the API will accept the request made with it. Walk the stages in order and write down what each one actually did, before you decide what it means.
For Mara's attempt, the printing site's own trace shows the callback arriving, then the token exchangeAn OAuth grant, RFC 8693, in which a client trades a token it holds for a new one, usually for another audience, with narrower access, or acting for someone. It lets a service call the next service without passing the original token along.. The callback line records the checks Correlating requests and responses described: the returned state matched the one the site stored for this attempt, and the iss parameter named the photo service as the server that answered.
14:22:07.418 callback state=match iss=https://auth.photos.example code=present
14:22:07.602 token.request grant_type=authorization_code
14:22:07.731 token.response status=200 token_type=Bearer scope="openid photos.read" expires_in=600Sign-in worked, the return worked and the token was issued with the scopes the site asked for. The next line is the one that matters, the API call:
GET /albums/7731 HTTP/1.1
Host: api.photos.example
Authorization: Bearer <redacted>
HTTP/1.1 404 Not Found
Content-Type: application/json
X-Request-ID: 5f1c9e2a-7d40-4c51-9a3e-1b2f6c8d0e44
{"error": "not_found", "error_description": "No album with this ID is available to this user."}That is the first failure, and it moves the investigation well away from Mara's password. The API accepted the token, understood the request and declined to return album 7731. Notice what the 404 does and does not say. A photo service that keeps private albums private answers "not found" both for an album that does not exist and for one that exists but belongs to someone else, so that a curious user cannot probe for other people's album IDs, as Enforcing access at an API explained. From outside, those two answers look the same. Inside the photo service they are different decisions with different reasons, and that is where you look next.
The X-Request-ID header is the thread you pull. It names this one request on the server and grants nothing, so it is safe to put in a ticket. The photo service's support team will ask for it first, and if you run both systems, it is how you find the server's own record of the decision.
Use the audit trail and request logs for different questions
Most identity systems keep two kinds of record, and they answer different questions. An audit record is about accountability: who asked to do what, to which object, with whose authority, and whether it was allowed. A request log is about execution: which request arrived, how long it took, which processing stage it reached and what status it returned. A sensitive request often appears in both, because each view tells you something the other does not.
Here is what the photo service holds for Mara's API call. The audit record:
time 2026-10-13T14:22:07.812Z
operation photos.album.read
outcome rejected
reason no_grant
client printer-web
subject user-5521 (Mara)
object album 7731 (owner: user-6014)
request_id 5f1c9e2a-7d40-4c51-9a3e-1b2f6c8d0e44And the request log line with the same request ID:
2026-10-13T14:22:07.809Z GET /albums/7731 404 stage=authorization duration_ms=11
client=printer-web request_id=5f1c9e2a-7d40-4c51-9a3e-1b2f6c8d0e44The log says the request got past token validation and stopped at the authorization stage after 11 milliseconds, so this is not a timeout, an outage or a bad token. The audit record says why: nothing grants Mara access to album 7731, because that album belongs to another customer. The 404 was the API keeping that fact to itself.
Join the two by request ID, never by "they happened around the same time". On a busy service a dozen unrelated requests share the same second, and a refusal that lands next to a configuration change is not evidence that the change caused it. If you cannot find a shared identifier, say that the link is unproven. A diagnosis that states the limits of its evidence is more useful to the next engineer than a confident guess.
One more check rules out the token entirely. Ask for Mara's own album with the same token, and it comes back 200. The token is fine, the grant is fine, and the printing site asked for the wrong album. The question is now why it asked for 7731, and the printing site's deployment history answers it: that morning's release changed how the preview chooses which album to open.
Repair the fault you found
Once you know the cause, fix that cause and nothing else. Here the fix is to correct the preview's album selection. Two shortcuts are tempting, and both are wrong. Giving Mara broader access to other people's albums would make the error go away by weakening a boundary that was working exactly as intended. Resetting her password would change a credential that never failed and leave the bad request in place.
Then verify in two directions. First, repeat the original operation: Mara's preview should open her own album. Second, repeat a request that should still be refused: the same token asking for album 7731 must still get a 404. The second check is easy to skip and important to keep. A repair that makes everything succeed may have removed a protection along with the fault, so recovery means the intended work succeeds while the restriction around it still holds.
A method for every incident
Mara's ticket was a simple one, but the steps you took work for every identity incident, from a refused token request to a broken SAMLThe Security Assertion Markup Language, a federation standard widely used for workplace single sign-on, in which the identity provider sends the application a signed assertion about the user. connection to a provisioningCreating accounts in applications, keeping their attributes and access current, and disabling them when people leave, without waiting for each person to sign in. SCIM is a standard way to send those changes. job that stopped writing. The later Troubleshooting lessons use them without repeating them, so here they are in one place:
- Pin down the attempt. Who, which application and environment, when, what should have happened, and whether it ever worked.
- Find the failing stage. Walk the stages in order. Write down the last one that succeeded and the first one that failed, and read the failure in its own terms: an authorization error, a token endpoint error, an API challenge or a provisioning error.
- Join the evidence by request ID. The audit record says who asked for what and how the decision went. The request log says how the request ran. Link them by a shared identifier, not by timestamps.
- Test the hypothesis before you trust it. A change record or a plausible theory explains a failure only when what it names reproduces the failure. Being close in time is not enough.
- Make one narrow repair. Fix the cause you proved. Don't widen grants, disable checks or revive retired credentials to make an error disappear.
- Prove recovery and the boundary. Repeat the original operation, then repeat one request that must still be refused.
- Hand off. Write a short note another engineer could act on without asking you anything.
The order matters most when an incident has more than one fault. A request refused at client authenticationChecking evidence that someone, or some application, controls an account, such as a password or a passkey. It establishes which account is being used, not what that account may do. never reaches the scope check, so a second fault can sit hidden behind the first. Each repair can reveal the next refusal, and a new error after a repair usually means the investigation has moved one stage further.
Worked example: the handoff note
A good handoff note lets someone who was not there understand what failed, what proved it and what was changed. It refers to records by their identifiers and leaves out anything that works as a credential: codes, tokens, cookies, secrets, full callback addresses and private content. Here is the note for Mara's incident:
Symptom: Customer saw "We could not open your preview" after signing in (14:22 UTC, production).
Last good stage: Token exchange, 200, scope "openid photos.read".
First failure: GET /albums/7731 returned 404; audit reason no_grant
(request 5f1c9e2a-7d40-4c51-9a3e-1b2f6c8d0e44). Album 7731 belongs to another customer.
Cause: This morning's release changed the preview's album selection. The same token reads
the customer's own album (200), so the token and grant are not at fault.
Repair: Restored the preview's album selection (release 2026.10.13-2).
Verification: Customer's own album opens in the preview. Album 7731 with the same token: still 404.
Not changed: Customer password, roles and album permissions.The "Not changed" line earns its place: it tells the next engineer which tempting repairs were considered and left alone. If a request timed out halfway through a change, say that too. "Unknown outcome" and "failed" are different findings, and the next engineer needs to know which one you have before they try the operation again.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Find why the preview will not openA release changes the preview application while you are not looking. Follow one attempt through sign-in, token and API, find the last stage that worked, find the change in Audit, repair it and write a safe handoff note.