The aud claim in multi-tenant JWTs: when to use it, what to put in it

aud (audience) is the JWT's defense against a token issued for one consumer being replayed against another. In multi-tenant apps, that defense matters.

Private: Decoding, analysis, signature verification, and token generation all run in your browser. Nothing is sent to any server, except a JWKS URL you explicitly enter and click Verify on.

At a glance

Spec reference
RFC 7519 §4.1.3
Type
String or array of strings
Validation rule
Verifier must match its identifier
Common values
API URL, app id, tenant id

The `aud` claim says "this token is intended for these consumers". A consumer must verify it's in the audience before trusting the token. Without `aud`, a token your auth server issued for service A can be replayed against service B with no friction. In multi-tenant apps where services span tenants, this is exactly the cross-boundary leak you don't want.

How aud blocks cross-service replay

Imagine your auth server issues JWTs that the billing API and the analytics API both consume. Without `aud`, a token issued for billing is also valid against analytics — a frontend bug that leaks the billing token (e.g., embeds it in a third-party analytics request) effectively leaks analytics access too.

With `aud: "billing.example.com"`, the analytics API rejects the token because its expected aud (`analytics.example.com`) isn't present. The leak is contained to one service.

Frequently asked questions

What should I put in aud?
The intended consumer's identifier. For an API, use the API's URL or a stable app id (`https://api.example.com` or `app_acme_billing`). Each service that consumes JWTs validates that its identifier appears in `aud`.
Can aud include the tenant id?
Yes — combining the consumer + tenant in `aud` (e.g., `aud: ["api.example.com:tenant_acme"]`) gives you tenant-scoped audience validation. It's belt-and-braces with the regular tenant claim. Useful when you have shared services that handle multiple tenants and want defense in depth.
Can aud be an array?
Yes. Use an array when a token is intended for multiple services (e.g., a frontend that calls several APIs with one token). The verifier checks that its own identifier is *in* the array. Don't use array form for a single intended consumer — it's a weaker constraint.

Related guides

Also useful: UUID GeneratorJSON Formatter