aud) — the intended recipient of the token. Example token:
"aud": "billing" was presented to the warehouse server. The warehouse server accepted and executed the request without complaint — but it was never authorized to do so. This is a classic case of token misuse.
Authorization behavior is specified per transport: the spec describes recommended practices but does not force every server to perform authorization in all transports. For remote transports (HTTP) the recommendation is to use OAuth 2.1. For local transports (stdio), credentials often come from environment variables and do not cross a network boundary.

OAuth actors and their roles
When a client uses HTTP and OAuth, three parties typically participate:
Summary: clients obtain tokens, the authorization server issues them, and the resource server validates them.
How a client discovers the right authorization server
Discovery generally happens in a few steps. The resource server helps the client find the authorization server by returning metadata hints. Below is a concise step-by-step flow.Step 1 — Initial request triggers discovery hint
- Client requests a protected resource without a token.
- Resource server responds with
401 Unauthorizedand aWWW-Authenticateheader that points to resource metadata.
Step 2 — Resource metadata
- The URL from the header hosts a published resource-server metadata document.
- That document lists authorization servers the resource trusts and other metadata in a standardized format.
Step 3 — Authorization server discovery
- The client selects an authorization server from the resource metadata list and fetches that server’s description.
- The authorization server metadata includes the endpoints the client needs, for example:
Step 4 — Standard OAuth login (authorization code + PKCE)
- The client directs the user to the authorization endpoint.
- The user authenticates; the client receives a short-lived authorization code.
- The client exchanges the code at the token endpoint for an access token. The code exchange should use PKCE (Proof Key for Code Exchange) to prevent authorization code replay attacks. See RFC 7636 for details.

Audience (aud) claim and the resource parameter
When requesting a token, the client indicates the intended target with parameters such asresource (RFC 8707) or other audience mechanisms. The authorization server encodes this intent into the token’s aud claim.
A resource server must perform a simple check on every incoming token: verify the aud matches the server identifier (i.e., “is this token meant for me?”). If the audience does not match, the resource must reject the request.
In Alan’s case, the warehouse server skipped the audience check and accepted a token issued for "billing". Accepting such a token is called token passthrough and is explicitly forbidden by the specification.

A resource server MUST validate the token signature, expiration, and the audience (
aud) claim and reject any token not issued for that server. Token passthrough is explicitly forbidden.Token delegation and calling upstream services
The same audience principle applies when a server calls an upstream service on behalf of a request:- Do not forward an inbound token to an upstream service unless that token’s audience explicitly includes the upstream service and your security model allows delegation.
- Obtain a token whose
audidentifies the upstream service via an appropriate OAuth flow (client credentials, on-behalf-of, or other delegation mechanism).
- Validate inbound tokens fully: signature,
exp,aud,iss, and scopes/permissions. - When making outbound calls, present a token intended for the upstream service.
- Use standard OAuth grants for machine-to-machine tokens and delegation (client credentials, on-behalf-of).
- Avoid reusing or forwarding tokens issued for other audiences.
Key takeaways
- Authorization behavior is transport-aware; follow the recommended practices for your transport (e.g., OAuth 2.1 for HTTP).
- Use discovery metadata so clients can find authorization servers securely.
- Always validate tokens, and always enforce the
audclaim. - Never accept or forward tokens that were not issued for the service handling the request.
Links and references
- OAuth 2.1 Overview
- RFC 7636 — PKCE (Proof Key for Code Exchange)
- RFC 8707 — Resource Indicators for OAuth 2.0
- Okta