SecurityJWTJWSclaimsJWE

JSON Web Token

Definition

A JWT (RFC 7519) is a base64url-encoded set of claims, such as iss, sub, aud and exp, protected by a signature (JWS, RFC 7515) or, less often, encrypted (JWE).

In practice

Because a signed token carries its own proof, any service holding the issuer's public key can verify it without a network call, which removes the session store or introspection endpoint from the request path. Verification takes microseconds. OAuth access tokens are often JWTs (RFC 9068) and OpenID Connect ID tokens always are.

The flip side is revocation: a JWT stays valid until exp, and roles inside it go stale, so keep access tokens short-lived (5 to 15 minutes) and pair them with refresh tokens. Pin the expected algorithm (never none, never HMAC when you expect RSA or ECDSA), always check aud, and remember the payload is only encoded, not encrypted.

Example

Header {"alg":"ES256","kid":"2026-11","typ":"at+jwt"}, payload {"iss":"https://auth.example.com","sub":"u_123","aud":"orders-api","scope":"orders:read","exp":1795600900}.