How it works
The explanation, with examples you can run.
The ladder of second factors
From weakest to strongest:
- SMS or voice codes. Better than nothing, but vulnerable to SIM swaps, number porting and interception. NIST SP 800-63B lists phone-network delivery as a restricted authenticator.
- Authenticator-app codes (TOTP) and push approvals. No phone network involved, but the user can still type a code into a fake site, or approve a push they didn't start. "Push fatigue" attacks spam requests until someone taps yes; number matching helps.
- WebAuthn: security keys and passkeys. Phishing-resistant by design.
How a passkey login works
At registration, the user's authenticator (phone, laptop, password manager or USB key) creates a new key pair for your site. Your server stores the public key and a credential ID. The private key stays with the authenticator.
At login:
- Your server sends a random challenge.
- The browser passes it, together with your site's origin, to the authenticator.
- The user unlocks the authenticator with a fingerprint, face or PIN. That check happens locally; the biometric never leaves the device.
- The authenticator signs the challenge and origin data with the private key for your site's relying party ID.
- Your server verifies the signature with the stored public key and checks the challenge and origin.
Three properties fall out. There is no shared secret to leak from your database. The signature covers a fresh challenge, so it can't be replayed. And because the browser reports the real origin and the authenticator only uses keys created for that site, examp1e.com can't get a usable signature for example.com.
Synced and device-bound passkeys
Most consumer passkeys are synced through the platform's keychain or a password manager, so a new phone doesn't mean a lost account. Device-bound keys, typically hardware security keys, never leave the device. NIST allows synced passkeys at AAL2 but not at AAL3, which needs non-exportable keys; most consumer and business apps are fine with synced passkeys, while high-assurance admin access often uses hardware keys.
Rolling it out
- Use a well-maintained WebAuthn library on the server; don't hand-roll the verification.
- Offer passkeys alongside passwords first, then as the default. Let users register more than one.
- Protect admin and staff accounts with phishing-resistant MFA first; they are the most valuable targets.
- Treat recovery as part of authentication. Email resets, support calls and recovery codes are how attackers get around strong login, so rate-limit them, notify the user, and add a delay or extra checks for sensitive changes.
Check yourself
3 questions. Get them all right to finish this topic.
0 of 3 right so far. Get all three to finish this topic.