Lesson 01Identity
Cookies & Login Sessions
HTTP keeps no memory between requests. So how does the server know you are logged in? The answer is two small things: a cookie in the browser and a session behind it.
- Layer
- Layer 7 · Application
- Reference
- RFC 6265 (cookie)
- Steps
- 7
NETLEARN · your study buddy
Net · guide
Hi! I’m Net, your guide today. We’ll look at Cookies & Login Sessions in the Sessions & Identity module.
how it works
tap Net · advance one step⟲ button · start overEnter · open the full explanation
legendrequestcontrolresponsemessage in flight
Common misunderstandings
- A cookie without Secure can leak over an unencrypted network; without HttpOnly, a single XSS hole is enough to steal the login session.
Key notes
- Cookie vs session
- The cookie lives in the browser (the key); the session lives on the server (the content). Anything sensitive stays on the server.
- HttpOnly
- The cookie cannot be read by JavaScript. This is important so that XSS cannot steal the session.
- SameSite
- Limits the cookie from being sent on requests from other sites. Holds back CSRF.
- Stateless alternative
- JWT puts the data inside the token itself, but it is hard to revoke before it expires.
