Authentication
Verifying who a user is.
Authentication covers passwords, sessions, tokens, single sign-on and passkeys. It is easy to get subtly wrong, so proven libraries and services are usually the right choice. Its design also affects signup friction.
Why it matters for a product engineer
Authentication is the door to every account. It is easy to get subtly wrong, and one mistake exposes everything behind it. It is also the first friction in the product: every rule on a signup form loses some people. A product engineer decides both sides, the security and the experience.
How to do it
- Use a proven service or library. Prefer sign-in without a password: passkeys, or a provider people already use.
- If you keep passwords, follow NIST: ask for length, not a mix of characters. Accept long passwords, spaces and Unicode, and allow paste, so password managers work.
- Compare each new password with a list of breached and common passwords, and say why you reject one.
- Store passwords with a slow, salted password hash, such as Argon2id or bcrypt.
- Limit failed attempts, and offer a second factor.
- Use the same generic message for a wrong user name and a wrong password, at sign-in and at password reset.
Common mistakes
- Rules for symbols and digits. NIST notes that people respond to them in very predictable ways.
- Forced password changes every few months.
- Security questions, such as the name of a first pet.
- Writing your own session or token logic.
- A signup form that asks for a password before the person has seen any value.
Example
NIST asks for a check against breached passwords, but sending a password to an outside service is a new risk. Cloudflare and Troy Hunt’s Pwned Passwords solved this with k-anonymity. The site hashes the password with SHA-1 and sends only the first 5 of the 40 hexadecimal characters. The service returns every breached hash that starts with them, about 478 on average, and the site compares them itself. The password, and even its full hash, never leave the site.
Password rules, old habits and NIST in 2025
| Old habit | NIST SP 800-63B-4 | |
|---|---|---|
| Minimum length | 8 characters | 15, or 8 with a second factor |
| A mix of character types | Required | Not allowed |
| Change on a schedule | Every few months | Only after a compromise |
| Security questions | Common | Not allowed |
| Check against breached passwords | No | Yes |
The new rules move the work from the person to the system: long passwords, nothing to remember about symbols, and a check against breached ones.
ReportedNIST SP 800-63B-4, Aug 2025
Sources: NIST SP 800-63B-4: authentication and authenticator management ↗ · Validating leaked passwords with k-anonymity (Cloudflare) ↗ · Authentication cheat sheet (OWASP) ↗
In practice
Real productsResources
1- docsGo deeper
Authentication cheat sheet ↗
OWASP · 25 minWhat a sound login, password and session setup needs, checked by security practitioners.
Tools
1- ToolFreemium
Semgrep
Static analysis for security bugs and code patterns, with an open-source core engine.