IAM glossary
What is JWT?
JSON Web Token
A compact token in three Base64URL parts: header, payload and signature. Anyone can read it, so it must never contain secrets; the signature only proves it was not changed.
How it works
A JSON Web Token is three pieces of text separated by dots: header, payload and signature. Header and payload are JSON encoded in Base64URL, so anyone can decode and read them. The header says how it is signed (alg) and with which key (kid); the payload carries the claims.
The signature is computed over header and payload with the issuer’s key. If someone changes a single character, the signature no longer matches. So a JWT is readable by everyone, but cannot be modified without being noticed. It is not encrypted: never put secrets in it.
A simple example
This token eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiI0MiIsImV4cCI6MTc5MjAwMDAwMH0.Sig... decodes to header {"alg":"RS256"} and payload {"sub":"42","exp":1792000000}. If an attacker changes sub to 43, the API verifying the signature rejects the token.
Common mistakes
- Accepting
alg: noneor letting the token choose the algorithm. - Decoding without verifying, and treating the content as true.
- Using JWTs as long sessions that cannot be revoked.
See it in action: change the token, break the signature
..- Signature
- Expiry
- Audience