JWT and JWS field guides
From token structure to algorithm confusion, claim validation and key rotation, in the order you meet them.
- JWT structure and Base64URL: reading the three parts correctlyWhat the header, payload and signature parts carry, how Base64URL differs from Base64, and where people go wrong when reading a token.
- HS256, RS256, ES256, EdDSA: choosing a signature algorithmSymmetric HMAC versus asymmetric RSA, ECDSA and EdDSA, key and signature sizes, and when to prefer PS256 or ES256.
- alg=none and algorithm confusion: why the header alg is not trustworthyHow alg=none skips signature checking, how algorithm confusion uses a public key as an HMAC secret, and how to defend against both.
- Validating exp, nbf, iat, aud and iss, and handling clock skewThe order for validating time claims, audience and issuer, how to set a leeway, and what to do about a token without exp.
- JWKS, kid and key rotation: fetching and selecting public keys safelyThe shape of a JWKS document, choosing a key by kid, running an overlapping rotation, and the caching pitfalls to avoid.