Authentication & Identity

What Is JWT (JSON Web Token)? Definition, Architecture & Defense

Quick Definition: A JSON Web Token (JWT, RFC 7519) is a compact, URL-safe token format consisting of a Base64URL-encoded JSON Header, Payload (claims), and cryptographic Signature separated by dots.

How JWT (JSON Web Token) Works in Practice

Stateless APIs issue a signed JWT after login containing claims like sub (user ID), role, iat (issued at), and exp (expiration). When the client sends the JWT in an Authorization: Bearer header, the server verifies the cryptographic signature before trusting the claims. Importantly, standard JWTs (JWS) are signed, NOT encrypted—anyone can Base64URL-decode and read the payload.

Defensive Mitigation & Hardening Checklist

Explicitly whitelist allowed signing algorithms server-side (reject alg: none and prevent RS256-to-HS256 confusion), enforce short expiration times (exp), and never place sensitive secrets in the JWT payload.

Hands-On Tool & Cheat Sheet


Related Security Glossary Terms