Track 07 · Lesson 18 of 18Identity and login

Track 07 · Identity and login

Compare the designs

Lesson 18 of 18· 6 min

Auth has two separate questions that people often mix up. How do you prove who you are? (password, social login, passkey, magic link). How do you stay signed in afterwards? (sessions, tokens, cookies, a BFF). Your answers can be chosen independently.

Every design side by side

Pick a row for the full explanation

ApproachLong-lived credential safe from XSSSafe from CSRF by defaultInstant logout on the serverStays signed in silentlyWorks with an existing separate APILow build and run effort
✕ No✓ Yes✕ No◐ Partly✓ Yes✓ Yes
✓ Yes◐ Partly✓ Yes✓ Yes✕ No◐ Partly
✓ Yes◐ Partly◐ Partly✓ Yes✕ No◐ Partly
✓ Yes✓ Yes◐ Partly✓ Yes✓ Yes◐ Partly
✓ Yes◐ Partly◐ Partly✓ Yes✓ Yes✕ No
◐ Partly◐ Partly◐ Partly✓ Yes◐ Partly◐ Partly
✓ Yes✓ Yes◐ Partly✓ Yes◐ Partly✓ Yes

BFF + sealed refresh cookie · your setup

Only auth traffic goes through a small same-origin server that seals the refresh token in an HttpOnly, SameSite=Strict cookie. Everyday calls go direct with a short-lived JWT. Logout revokes the refresh token immediately; an already-issued access token lives until it expires.

When it fits: Most of the safety of a full BFF at a fraction of the cost, with almost no backend changes.

Staying signed in#

Seven common approaches, scored against six questions: is the long-lived credential safe from XSS, is it safe from CSRF by default, can the server log someone out instantly, does it stay signed in silently, does it work with an existing separate API, and how much does it cost to build and run. “Partly” means it depends on configuration. Your setup from the decision helper is marked.

Proving who you are#

Passwords with optional 2FA are universal; social sign-in and passkeys remove the password to steal; magic links are only as safe as the inbox; enterprise SSO is expected by larger customers; and API keys are for machines, never people.

Where this track leaves you#

You can now read any web app’s auth and answer the questions that matter: where the secrets live, how they’re refreshed, what happens when something fails, and how a session really ends. The next track turns to attacks, and you’ll recognize most of the defenses.

Check yourself

Which statement is true?