Skip to content
StackDecode
System Design
13. Security ArchitectureAnimated

Session-Based Authentication

The server keeps a session and gives a cookie.

The idea

After login, the session id is stored server-side and the browser sends it in a cookie.

Watch it work

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

BrowserServerSession storePOST /login
  • current message
  • earlier
  • failure or attack

The user logs in.

step:
1/6
from:
Browser
to:
Server
1/6

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

Step by step

  1. 1User logs in
  2. 2Server creates a session
  3. 3Cookie holds the session id
  4. 4Server looks it up on each request

Where it is used

Traditional web apps.

Watch out for

Session store scaling and cookie theft.

Related