Free, no-obligation consultation. Call (747) 249-8760

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.

Stop storing tokens wrong: the auth-token storage cheat sheet for web apps

What's inside

  1. 01One table: what to store where (cookie vs memory vs localStorage)
  2. 02The 5 cookie settings that block token theft (HttpOnly, Secure, SameSite, __Host-, Max-Age)
  3. 03Copy-paste code for Express and Next.js
  4. 04The CSRF trade-off, explained, plus a 10-minute audit

By @afeez_sdbytes · SoftwareDevBytes × Global McLien Software Solutions.

Rather have it done for you?

Hand it to a senior team.

We review and fix auth in web and mobile apps: token storage, cookies, CSP and CSRF.