What Is a JWT? JSON Web Tokens & Stateless Authentication
Learn what JSON Web Tokens (JWT / RFC 7519) are. Understand stateless authentication, Bearer tokens, token anatomy, and client-side decoding vs verification.
What Is a JSON Web Token?
A JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact, self-contained way for securely transmitting information between parties as a JSON object. JWTs are commonly used for stateless user authentication and OAuth 2.0 authorization.
The 3 Parts of a JWT
A JWT string consists of three dot-separated Base64URL-encoded parts:
header.payload.signature
Example: eyJhbGciOiJIUzI1Ni... . eyJzdWIiOiIxMjM0NT... . 4e9g4yWJm7c8VvW2...
- Header: Specifies the cryptographic algorithm (e.g.
HS256,RS256) and token type (JWT). - Payload: Contains claims (user ID, roles, expiration time).
- Signature: Cryptographic hash or signature verifying that the token was not altered in transit.