JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.
Structure
Header.Payload.Signature
- Header: Algorithm and token type.
{"alg": "HS256", "typ": "JWT"} - Payload: Claims (data).
{"sub": "123", "admin": true} - Signature: HMACSHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), secret)