Magic links: simplest to implement
app.post('/login', async (req, res) => {
const token = generateToken();
await sendEmail(req.body.email, `Click to log in: /verify?token=${token}`);
res.json({ sent: true });
});
A single-use, expiring link sent by email removes the password entirely from the equation - nothing to reuse, nothing to leak in a breach, nothing to forget.
WebAuthn: biometrics and hardware keys
The WebAuthn standard lets a site authenticate a user with their device's fingerprint sensor, face unlock, or a physical security key, using public-key cryptography rather than a shared secret transmitted over the network:
const credential = await navigator.credentials.create({
publicKey: { /* challenge, rp, user, pubKeyCredParams */ }
});
What we've shipped so far
Magic links on a couple of smaller client dashboards, WebAuthn still mostly in evaluation - the UX is excellent once set up, but the setup flow itself still needs a fallback for users on unsupported devices.
Magic links trade one weak point for a different one
A magic link removes the password-reuse and phishing risks tied to passwords, but shifts trust entirely onto the security of the recipient's email account - anyone with access to that inbox can log in. That's usually a reasonable trade for consumer apps, since most people's email accounts are already better protected (2FA, provider security teams) than a password they've reused across a dozen sites.
// Server: generate a short-lived, single-use token, email a link containing it
const token = crypto.randomBytes(32).toString('hex');
await redis.set(`magic:${token}`, userId, { EX: 600 }); // 10 min expiry
WebAuthn is the stronger option where it's supported
WebAuthn (passkeys) binds authentication to a physical device using public-key cryptography - nothing secret ever crosses the network, which makes it resistant to phishing in a way magic links and passwords fundamentally aren't. The remaining friction is UX: account recovery when a device is lost still needs a fallback, and that fallback path is usually where the real security tradeoffs of a passwordless system end up living.