JWT audience and issuer claims
November 13, 2026 · 14 min read
A valid signature is not enough if the token was minted for another API or tenant. iss names who issued the JWT; aud names who may consume it. Skipping either check lets tokens from staging auth work against production APIs when secrets leak between environments.
Issuer (iss) validation
Configure an allowlist of issuer strings (HTTPS URLs or tenant-specific identifiers). Fetch signing keys from the issuer JWKS URI derived from OpenID discovery. Reject tokens whose iss does not match exactly - string comparisons should be explicit, not substring guesses.
Audience (aud) validation
aud may be a string or array of strings. Your API must match one intended audience value - often the API resource identifier or client id for access tokens. Resource servers reject tokens issued for a different microservice even with valid signature.
{
"iss": "https://auth.example.com/",
"sub": "user_42",
"aud": ["https://api.example.com", "https://reports.example.com"],
"exp": 4102444800
}
Multi-tenant iss and aud
SaaS platforms may encode tenant in iss path or use per-tenant issuers. Map tenant to JWKS dynamically but never skip signature verify. Pair aud with route prefixes so tenant A tokens cannot call tenant B admin paths.
OpenID Connect id_token vs access token
ID tokens target the client application (aud = client_id). Access tokens target resource APIs - different aud rules. Do not validate id_token aud on your backend API unless that API is the OAuth client consuming the id_token.
Debugging iss/aud failures
401 “invalid audience” after deploy usually means gateway config drift. Paste tokens into JWT decoder and compare iss/aud to environment variables character by character - including trailing slashes.
FAQ
- Must aud match exactly?
- Your verifier library defines rules - typically your API id must appear in aud string or array.
- Can iss change during key rotation?
- iss should stay stable per tenant; rotation uses kid, not a new iss.
- What if aud is missing?
- Reject for resource APIs unless a tightly controlled internal profile documents the risk.
Related: JWT authentication flow · JWT best practices · Debug invalid JWT errors · What is a JWT