Posts tagged “authentication”

  1. How should you store passwords?

    With a slow, memory-hard password hash (argon2id, or scrypt or bcrypt), a unique salt per password, and settings that make each guess cost tens of milliseconds. A fast hash like SHA-256 lets a GPU try billions of guesses a second. Plus the parts around the hash that matter as much: rate limits…

    · 6 min read · Security

  2. OAuth 2.0 and OpenID Connect: which flow for which client?

    Authorization code with PKCE for anything with a user (web, SPA, mobile, desktop), client credentials for machine-to-machine, the device flow for TVs and CLIs. The implicit and password grants are retired. OAuth is about access to APIs; OpenID Connect adds who the user is. Diagrams of each flow.

    · 6 min read · Security

  3. Which kind of 2FA should you offer?

    SMS codes are better than nothing and the weakest option. Authenticator-app codes (TOTP) stop password reuse but not phishing. Push approvals invite fatigue attacks. Security keys and passkeys are the only phishing-resistant option. What each defends against, what to offer, and why recovery codes…

    · 5 min read · Security

  4. Sessions or JWTs: which should you use to keep users signed in?

    Two good ideas for different jobs. For a web app with its own backend, server-side sessions are simpler and safer: a random cookie, instant revocation, nothing sensitive in the browser. JWTs earn their place between services and across organisations, where checking a signature beats a database…

    · 5 min read · Security

  5. How should users sign up?

    Email and password is universal but leaves you guarding passwords. Magic links remove passwords but depend on email speed. Social login is one click but ties users to another company. Passkeys are the most secure and still unfamiliar to many. B2B customers will ask for SSO. How to choose, and how…

    · 6 min read · Security

  6. Access tokens and refresh tokens: why two, where do they live, and what happens when one leaks?

    Why two tokens: a short-lived access token shown to every API, and a longer-lived refresh token shown only to the auth server and rotated, so reusing a stolen one raises an alarm. Diagrams of the flows, where to store each token on web, mobile and server, and what an attacker gets from each kind…

    · 7 min read · Security