What is a JSON Web Token?
A JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.
It consists of three parts separated by dots (.): Header, Payload, and Signature.
- Header: Typically consists of two parts: the type of the token (JWT) and the signing algorithm being used, such as HMAC SHA256 or RSA.
- Payload: Contains the claims (statements about an entity and additional data).
- Signature: Used to verify the message wasn't changed along the way.
Note: Decoding a JWT is not the same as verifying it. Anyone can decode a JWT, but verifying its authenticity requires the secret key used to sign it.