Track 07 · Lesson 17 of 18Identity and login
- 01Authentication vs authorization
- 02Browser storage compared
- 03Sessions versus tokens
- 04Inside a JWT
- 05Access and refresh tokens
- 06Where to keep tokens
- 07Choosing a design
- 08The login lifecycle
- 09The token clock
- 10Dead or just unlucky? Refresh decisions
- 11Inside a secure session cookie
- 12Five tabs, one refresh
- 13“Log in with Google”: OAuth and PKCE
- 14Two-factor login
- 15Storing passwords
- 16Logging out properly
- 17Trade-offs and common mistakes
- 18Compare the designs
Trade-offs and common mistakes
Lesson 17 of 18· 6 min
No auth design is free. These are the costs and pitfalls that show up again and again in real projects. Each one says why teams accept or fall into it, and what fixes it.
Costs and common mistakes
Open each one; flag the ones in your project
0 flagged in your project
The high-severity four#
Tokens in localStorage, logging users out on transient errors, authorization only in the UI, and a Content Security Policy that still allows inline scripts. Each one turns a single bug or a short outage into a much bigger problem, and each has a well-known fix you’ve already seen in this track.
Costs you choose on purpose#
Some entries aren’t mistakes: they’re the price of a design. In-memory tokens cost a refresh on every page load. A BFF makes your frontend server part of login. Logging out of one device leaves the others signed in, usually deliberately. Know which of these you’re paying, and monitor them.
Docs drift#
Auth docs tend to describe an older storage or refresh scheme. When the docs and the code disagree, the code wins: fix the docs in the same pull request.
Check yourself