JWT security checklist - cover art

JWT and security 13 min read

JWT security checklist

October 11, 2026 · 13 min read

JWTs fail open when verification is incomplete. A checklist beats ad hoc copy-paste from tutorials. Run through these items on every service that calls jwtVerify or framework equivalents before production traffic - and again after key rotation.

Validate signature (and algorithm)

Test with the JWT decoder for structure, and the JWT generator for signed fixtures in CI - not for production secrets.

Check expiry and clock skew

Enforce exp with a small clock skew leeway (e.g. 60 seconds). Honor nbf when present. Short-lived access tokens (minutes) plus refresh rotation limits blast radius of stolen tokens.

Verify issuer and audience

Validate iss matches your identity provider and aud matches this API’s identifier. Skipping audience checks lets tokens minted for another service access your resources. Document expected values in OpenAPI security schemes.

Validate payload claims

Treat the payload as untrusted input even after signature verification. Map sub to internal user IDs; do not embed roles without re-checking authorization server state for sensitive actions. Strip PII from logs when debugging - decode locally, redact before sharing.

HTTPS, secure storage, and key hygiene

FAQ

Is decoding the same as verifying?
No. Decoding is readable inspection; verification checks signature and claims cryptographically.
What is the minimum TTL?
Depends on risk; 5–15 minutes for access tokens is common with refresh flows.
Should gateways verify JWTs?
Often yes for RS256 with cached JWKS, with the same checklist applied at the edge.

Related: Decode JWT safely · JWT security mistakes · JWT storage in browsers

Browse all tools