What is a JWT?
A JSON Web Token (JWT) is a compact, URL-safe token format used for authentication and information exchange. It consists of three parts: a header (algorithm and type), a payload (claims and data), and a signature (integrity verification).
JWT Structure
A JWT has three Base64url-encoded parts separated by dots: header.payload.signature. The header specifies the signing algorithm (e.g., HS256, RS256). The payload contains claims like sub (subject), iat (issued at), exp (expiration).
Common JWT Claims
iss (issuer), sub (subject), aud (audience), exp (expiration), nbf (not before), iat (issued at), jti (JWT ID). Custom claims can contain any JSON data.