Beta

Create a tenant

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

Everything broke after last night's change window

Last night's print orders never went out, and a change window made three changes by three people. This lesson follows one fresh attempt stage by stage, finds two faults in the order the requests reveal them, rules out a change that only looks guilty, and repairs one cause at a time without undoing the window's deliberate changes.

Last night's orders never went out

The message from the printing company's shift lead is waiting when you start: "Last night's print orders never went out. Nothing works. There was a change window yesterday evening, so it's probably that."

The integration in question is the printing company's evening order run. At 23:30 each night a backend job, registered at the photo service as the confidential client printer-evening-orders, gets an access token from auth.photos.example with the client credentials grant, then reads the day's ready print orders and their photos from api.photos.example. No user is involved. The job acts on its own authority, which is why it authenticates with a client secret.

The change window ran from 21:00 to 23:00, and the change record lists three entries by three people:

CHG-4471  21:04  Anika   Rotated client secret for printer-evening-orders. Overlap: none.
                         New secret stored as version 8 in the deployment vault.
CHG-4473  21:40  Kenji   Photo API now accepts tokens for resource https://api.photos.example/v2 only.
                         Client configurations updated: printer-web, photos-mobile.
CHG-4478  22:15  Greta   Disabled client photos-export-legacy (no requests in 90 days).

Any of these could be the cause, more than one could be, and "it's probably that" is a starting point, not a finding. Before you read the change record closely, pin down what should have happened: which client, which token request, which API call, in production, at 23:30. Then follow one fresh attempt and let the requests tell you where they stop. The method from Finding the failing stage applies as it is. What this incident adds is more than one fault.

Start where the requests stop

The job's run has two stages that can fail: getting the token, then using it. Run the token request by hand with the configuration the job has deployed, and it fails at the first one:

POST /token HTTP/1.1
Host: auth.photos.example
Authorization: Basic <redacted>
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&scope=prints.read&resource=https%3A%2F%2Fapi.photos.example

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="auth.photos.example"
Content-Type: application/json
Cache-Control: no-store
X-Request-ID: 3b9e1f70-5a2c-4d86-8e14-c7a0d2f96b53

{"error": "invalid_client", "error_description": "Client authentication failed."}

OAuth 2.0 defines invalid_client as failed client authentication: an unknown client, a wrong credential, or an unsupported authentication method. Because the client tried to authenticate with HTTP Basic, the token endpoint answers 401 and challenges with WWW-Authenticate: Basic. Notice what this request has not reached. The server stops at client authentication, before it looks at the requested scope or the resource parameter, and long before any API call. Anything else that is wrong with the run is still invisible.

That is why the order matters. A request refused at the first stage can hide a second fault at the next one. Fix the first, and the same request moves forward and may be refused again further on: by the token endpoint itself, for example with invalid_scope if a release added a scope the client cannot have, or by the API. A new refusal after a repair usually means progress, so investigate each stage in the order the requests reveal it, and resist fixing things you cannot yet see fail.

Match each change to what is failing

Now the change record is useful, because you know which component to compare it with. The failing component is client authentication for printer-evening-orders. Two changes in the window touched client authentication, and only one of them names that client.

The photo service's audit record for your request settles it:

time        2026-10-20T08:12:02.118Z
operation   oauth.token
outcome     rejected
reason      client_secret_mismatch
client      printer-evening-orders
detail      presented secret matches retired version 7; current version 8 active since 21:04
request_id  3b9e1f70-5a2c-4d86-8e14-c7a0d2f96b53

CHG-4471 replaced this client's secret with no overlap, so the old value stopped working at 21:04, and the job is still presenting the old value. Version 8 went into the vault and nobody deployed it to the job. The subject of the change, the reason in the audit record and the client in the failing request all line up.

CHG-4478 is the tempting one. It disabled a client, it happened in the same window, and a disabled client is also refused with invalid_client, so it produces the very error you are looking at. But it names photos-export-legacy, and the failing request comes from printer-evening-orders. The audit reason is a secret mismatch, not a disabled client, and the legacy client made no requests in 90 days. A change explains a failure only when what it names is the component that is failing. Being in the window is not enough, so CHG-4478 stays as it is. Re-enabling it would revive a client nobody uses and fix nothing.

CHG-4473 names the photo API, a later stage that the run has not reached yet. Note it and leave it. You will know soon whether it matters.

One repair at a time

Write each change down before you make it, in a small ledger: the hypothesis, the evidence for it, the change, the result, and a request that must still fail afterwards. The last column is what stops a repair from quietly becoming a bypass.

The first repair is to deploy secret version 8 to the job. Bringing version 7 back would revive a credential the window meant to retire. Send the same token request with the current secret, and it succeeds. Decode the token's claims to see what the job now holds:

{
  "iss": "https://auth.photos.example",
  "sub": "printer-evening-orders",
  "aud": "https://api.photos.example",
  "client_id": "printer-evening-orders",
  "scope": "prints.read",
  "iat": 1792484050,
  "exp": 1792484650,
  "jti": "<redacted>"
}

Then run the job's first API call with it. The request gets one stage further and is refused there:

GET /print-orders?status=ready HTTP/1.1
Host: api.photos.example
Authorization: Bearer <redacted>

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token", error_description="The token audience is not accepted by this API"
X-Request-ID: e4c87a1d-2f59-4b03-91d6-6a3f0b8e5c27

This is the second fault, now visible, and not a sign that the first repair failed. The aud (audience) claim names the resource the token was issued for. The job asks for a token for https://api.photos.example through the resource parameter defined in RFC 8707, and the authorization server still issues one. But since CHG-4473 the photo API accepts only tokens whose aud is https://api.photos.example/v2, and it refuses the rest as invalid for this API. The change record's list of updated clients does not include printer-evening-orders. The migration was deliberate; this integration was missed.

So the second repair belongs in the job's configuration, not the API: request resource=https://api.photos.example/v2. Every client allowed prints.read can already ask for the new identifier. Asking the API team to accept the old audience again would undo a deliberate change to rescue one missed configuration. Had the change record shown the API moved by mistake, with no migration planned, the repair would run the other way: point the API back at its own resource. Which side to repair follows from which change was intended.

One fresh attempt, repaired one stage at a time. The API's 401 after the first repair was the second fault coming into view, not a failed repair.

Prove the whole original operation

A token is one stage of the run, and the run is what failed. Get a fresh token with the new secret and the new resource identifier, confirm that its aud is https://api.photos.example/v2, and then run the whole job: it reads the ready orders, fetches their photos and submits last night's fourteen orders. Use a freshly issued token for this. A token obtained before the rotation can stay valid until it expires, and a test that happens to reuse one proves nothing about the deployed configuration.

Then prove that the boundaries the window touched still hold. A token request with retired secret version 7 is still refused with invalid_client. A token for the old audience is still refused by the API. photos-export-legacy is still disabled. Recovery means the original work succeeds and none of last night's deliberate changes were undone to get there.

Worked example: the repair ledger

The finished ledger tells the next engineer what was wrong, what proved it, what changed and what still fails, including the change that was ruled out:

Repair ledger for the evening order run
HypothesisEvidenceChangeResultRequest that must still fail
The job presents the secret retired by CHG-4471.Token endpoint 401 invalid_client; audit reason client_secret_mismatch for printer-evening-orders, matching retired version 7 (request 3b9e1f70-...).Deployed secret version 8 to the job.Token issued. API now refuses it: 401 invalid_token, audience not accepted.Token request with version 7: 401 invalid_client.
CHG-4478 disabled the job's client.Ruled out: CHG-4478 names photos-export-legacy; the failing request is printer-evening-orders; reason is a secret mismatch, not a disabled client.None.Not applicable.photos-export-legacy stays disabled.
The token's audience no longer matches the API after CHG-4473.Token aud is https://api.photos.example; API expects https://api.photos.example/v2; job not in CHG-4473's updated clients (request e4c87a1d-...).Job requests resource=https://api.photos.example/v2.Token aud is the new identifier; full run submits 14 orders.Token for the old audience: API 401 invalid_token.

Its handoff line is short: two faults from two changes, found in the order the stages revealed them, one plausible change ruled out by comparing its subject with the failing client, two narrow repairs, the original run complete and every retired or replaced path still refused. No secret values appear anywhere in it, only version numbers and request IDs.

Check your understanding

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

After a change window, an integration's token request gets 401 invalid_client. The window disabled a client called reports-legacy and rotated the integration's own secret with no overlap. The audit record says client_secret_mismatch for the integration's client. What do you do first? 1 of 3

Choose one answer.

With the new secret deployed, the token request succeeds, but the API now answers 401 with error="invalid_token" and a description saying the token audience is not accepted. What does this tell you? 2 of 3

Choose one answer.

The change record shows the API's move to the /v2 audience was a planned migration that updated two other clients and missed the order job. Where does the narrow repair go? 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