Choose your depth. Learn at your own pace.
Understand it
A JSON Web Token is a compact way to carry claims between systems. A claim might identify a user or say when the token expires. Many JWTs are signed: the recipient can check whether the token was issued by a trusted signer and changed afterward.
A signature is not a locked envelope. In a typical signed JWT, the header and payload are encoded and can be read. Never assume the token hides personal information. Keep tokens out of public links and logs.
Under the hood
A compact signed JWT has three base64url-encoded parts: header, payload and signature. A verifier must use an allowed algorithm and trusted key, verify the signature, and validate expected issuer, audience and relevant time claims. Merely decoding the payload does none of those checks.
JWT is a format, not a complete login or authorization protocol. The application decides which claims to require and what permissions they imply. Different token types must not be interchangeable; an identity token intended for a client is not automatically an access token for an API.
Practitioner perspective
Plan key rotation, token lifetime, clock tolerance and revocation. Stateless verification trades per-request lookup for a window in which a previously issued token may remain valid. Short lifetimes and controlled refresh flows reduce that window but add operational requirements.
Audit validation failures and key-discovery behavior. Do not let an untrusted header choose an arbitrary key URL. Never log entire bearer tokens. A correctly validated token still requires object- and operation-level authorization at the API.
Watch it work
A fictional, simplified model. Select a component to inspect it, or follow the steps in order.
How credentials are checked
See the difference between storage, proof, validation and authorization.
A readable token is not a trusted token; validate claims before authorization.
How to use this example
Select Next step to read at your own pace, or Animate step to watch one exchange. Nothing advances until you choose.
What it means
Everyday example
State in this scenario
Inspect components & read every step
- Client
A program that asks another system for information or an action.
Example: A shopping app requests a list of products from a service.
- Verifier
The system checking whether the presented proof is acceptable.
Example: A sign-in service checks a submitted password against its stored password verifier.
- Credential store
Storage for authentication-related records. It should not hold passwords as readable text.
Example: A service stores salted password hashes and account information.
- Resource
The information or action someone wants permission to use.
Example: A private document or an account setting is a resource.
JWT validation
A readable token is not a trusted token; validate claims before authorization.
- Client Verifier: Signed token. The request includes a token, not its signing key.
- Credential store Verifier: Trusted public key. Resolve trusted verification material; this may be cached.
- Verifier Resource: Validated claims. Check issuer, audience and lifetime, then evaluate permissions.
- Resource Client: Allowed response. Only an authorized operation returns protected data.
Server session
An opaque cookie identifies server-side session state.
- Client Verifier: Session cookie. The browser sends an opaque session identifier.
- Verifier Credential store: Lookup session. The service reads the associated state.
- Credential store Verifier: User + expiry. Expiry and revocation affect the result.
- Verifier Resource: Identity context. Resource authorization is still required.
Password hashing
Use a password KDF such as Argon2id with a unique salt and suitable cost.
- Client Verifier: Password over TLS. The verifier receives the candidate in a protected connection.
- Credential store Verifier: Salt + KDF settings. Retrieve the stored salt, parameters and verifier.
- Verifier Credential store: Compare verifier. Compare computed and stored verifier safely; do not store plaintext.
- Verifier Client: Decision. Apply rate limits and additional factors where required.
Refresh token
Renewal is a separate credential flow, not an extension of an expired access token.
- Client Resource: Expired token. The resource rejects an expired access token.
- Client Verifier: Refresh credential. The client presents its refresh credential to the authorization server.
- Verifier Client: New access token. Issue a new token only after the refresh policy succeeds.
- Client Resource: Retry with token. The resource validates the new token and requested permissions.
API key
An API key is a credential with scope, expiry and revocation policy—not necessarily a user identity.
- Client Verifier: API key. The client presents a secret credential over TLS.
- Verifier Credential store: Lookup policy. Check status, expiry and configured permissions.
- Verifier Resource: Scoped caller. Authorize this operation under the credential’s policy.
Authorization failure
Authentication can succeed while the requested object remains forbidden.
- Client Verifier: Valid credentials. The verifier establishes who the caller is.
- Verifier Resource: Other user’s object. The application checks the target owner and action.
- Resource Client: 403 · denied. Protected content is not returned.
Fictional teaching trace. One moving dot represents an exchange, not a measured network capture.
Open the detailed lesson walkthrough
Explore the system
Issue
A trusted service signs header and claims.
Read every step without animation
Valid token
- Issue. A trusted service signs header and claims.
- Transport. The client sends the token to its intended API over TLS.
- Verify. The API checks signature, issuer, audience and lifetime.
- Authorize. The API checks permission for this specific resource.
A valid token reaches a separate permission decision.
Changed claim
- Issue. A token was signed with the user’s original claims.
- Alter payload. A claim is changed without the signing key.
- Verify. The signature no longer matches the protected data.
- Reject. The API rejects this modified token.
Decoding a changed claim does not make it authentic.
Explore deeper: additional experiment
Decoding is not verification
Signature, expected audience and lifetime pass this simplified model. Real implementations also check issuer and applicable claims, then enforce operation and object permissions.
A local teaching model with fictional inputs. It does not test a live system.
Attack view
The visual changes a claim after issuance. Signature verification rejects the modified token when the verifier uses the original trusted key and expected algorithm.
Defender view
- Pin allowed algorithms and validate issuer, audience and time claims.
- Use TLS and storage appropriate to the application’s threat model.
- Apply resource authorization after token verification.
Common mistakes
- Base64url is encoding, not encryption.
- JWT payload claims are untrusted until verification and validation succeed.
Check your understanding
Active recall: explain this idea in 30 seconds
A JSON Web Token is a compact way to carry claims between systems. A claim might identify a user or say when the token expires. Many JWTs are signed: the recipient can check whether the token was issued by a trusted signer and changed afterward.
Now give an example and name one limitation. Revisit the explanation if you get stuck.
Primary sources
Original explanations informed by these specifications and official resources. Source versions and lesson review are separate from product updates.
Content reviewed 2026-09-10. Read the editorial policy.