The format is described in RFC 7519 (IETF, May 2015). The server that issues a token signs it with its key, and any service holding the verification key can confirm that the claims have not been forged — without querying a database or the server that issued the token. In OpenID Connect the ID token is built this way; for OAuth 2.0 access tokens, the JWT format is fixed by the RFC 9068 profile.
How a token is built
A JWT is a single string of three parts separated by dots: a header, a set of claims and a signature. Each part is encoded in Base64url — a variant of Base64 without characters that are unsafe in URLs, so the token travels safely in an HTTP header, an address or a request body.
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyLTQyIn0.K_mvT7ZlE # header: {"alg": "HS256", "typ": "JWT"}# claims: {"sub": "user-42"}# signature: HMAC-SHA256(header + "." + claims, secret key)# (the base64url-encoded input is what gets signed, RFC 7515)The header names the signing algorithm: HS256 is HMAC with SHA-256 and a secret shared by issuer and verifier, while RS256 and ES256 are signatures made with a private key and checked with a public key. Asymmetric algorithms suit microservices: services verify the signature with the public key and never hold the issuer’s secret.
Registered claims
Claims are arbitrary name–value pairs, but the standard defines a set of registered names:
| Claim | Meaning |
|---|---|
iss (issuer) | who issued the token |
sub (subject) | whom the claims are about — usually a user identifier |
aud (audience) | the recipients the token is intended for |
exp (expiration) | the time, in seconds, from which the token is no longer valid |
nbf (not before) | the time before which the token must not be accepted |
iat (issued at) | when the token was issued |
jti (JWT ID) | a unique identifier for the token |
The verifying party checks iss, aud and the validity period: a correctly signed token whose exp has passed must not be accepted. A single JWT cannot be revoked before it expires; to handle that, systems keep lists of revoked tokens or issue short-lived ones.
Signed, not encrypted
The payload of a JWT is only encoded, not encrypted: anyone who obtains the token can read the claims with an ordinary Base64 decoder. The signature guarantees something else — that the content has not changed since issue and that the token was issued by someone holding the key. Never put secret data inside. If the content must be hidden, use JWE (RFC 7516), the encrypted variant of the same format; a standard signed token is called a JWS (RFC 7515).
Sources
the term is written from these pagesVerified 9 Nov