What is a JSON Web Token (JWT)?
A JSON Web Token (JWT) is an open standard defined in RFC 7519 for securely transmitting information between parties as a compact, URL-safe JSON object. JWTs are digitally signed, which means the information they carry can be verified and trusted.
Every JWT has three parts separated by dots: a Header (metadata about the token and signing algorithm), a Payload (the claims or data being transmitted), and a Signature (which proves the token hasn't been tampered with). Each part is Base64URL-encoded, making the token safe for use in URLs, HTTP headers, and cookies.
Important: JWTs are encoded, not encrypted. Anyone with access to a JWT can read its contents. The signature only guarantees integrity — it does not provide confidentiality. Never put passwords or sensitive secrets in a JWT payload.