A JWT (JSON Web Token, RFC 7519) is a compact, URL-safe token made of three Base64URL-encoded segments separated by dots — header.payload.signature — used to carry claims (statements about a user or session) between parties, most commonly for authentication and authorization on the web.
The header and payload are each JSON objects, Base64URL-encoded (without padding). The header names the signing algorithm (alg, e.g. HS256 or RS256) and token type; the payload holds claims such as sub (subject), exp (expiry, a Unix timestamp), and any application-specific fields. The signature is computed over the encoded header and payload joined by a dot, using the algorithm named in the header — HMAC-SHA256 for HS256, or an RSA/ECDSA signature for RS256/ES256.
Critically, a JWT is signed, not encrypted, by default. Anyone can Base64URL-decode the header and payload and read the claims in plain text — the signature only proves the token wasn't tampered with (and, if verified against a trusted key, who issued it). Confidential data belongs in an encrypted token (JWE, RFC 7516), not a plain signed JWT (JWS, RFC 7515).
Example structure:
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0In0.4pC1...
└──── header ────┘ └──── payload ────┘ └ signature ┘
{"alg":"HS256"} {"sub":"1234"}
alg: "none" vulnerability: a server that trusts the algorithm named inside the token, rather than enforcing an expected algorithm, can be tricked into accepting an unsigned token as valid.exp claim is still "correctly signed" — verifying the signature and checking expiry are separate steps, and skipping the second is a common bug.HS256 signing algorithm.HS256.