Free cheat sheet · Web auth
Stop storing tokens wrong.
If your auth token is in localStorage, one XSS bug lets an attacker copy it and sign in as your users. Here is where every token should live, plus the copy-paste config to put it there.
What's inside
- One table: what to store where (cookie vs memory vs localStorage)
- The 5 cookie settings that block token theft (HttpOnly, Secure, SameSite, __Host-, Max-Age)
- Copy-paste code for Express and Next.js
- The CSRF trade-off, explained, plus a 10-minute audit