Skip to content
StackDecode
System Design
13. Security ArchitectureAnimated

JSON Web Tokens (JWT)

A signed token carrying claims.

The idea

A JWT has a header, payload and signature, which a server can verify without a lookup.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

ClientAuth serviceAPIPOST /login (user, password)
  • current message
  • earlier
  • failure or attack

The user proves who they are once.

step:
1/7
from:
Client
to:
Auth service
1/7

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Server signs the claims
  2. 2Client stores the token
  3. 3Client sends it with requests
  4. 4Server verifies the signature and expiry

Where it is used

Stateless authentication.

Watch out for

Hard to revoke before expiry. Keep lifetimes short.

Related