Back to Blog

Passkeys and Rethinking Login in the Age of AI

December 2, 2026
10 min read
A red padlock resting on a laptop keyboard lit in green.

Most of the login pages I’m asked to build or fix still work the way they did in 2010: an email, a password, and maybe a six-digit code by text message. That setup was never great. AI has made it worse, because the attacks it was barely holding off are now cheaper to run and better written.

This post covers two things that belong together. First, passkeys, which are the most practical way I know to take passwords out of a site. Second, what changes about login when some of the “users” hitting your app are AI agents acting for a person, and some of the attackers are using the same tools.

What AI changed about attacks on login

Phishing used to give itself away. Odd grammar, the wrong logo, a sender address nobody would trust. Language models removed most of those tells. A phishing email can now be written in fluent English, Spanish or Portuguese, in the house style of the company it imitates, and personalised from someone’s LinkedIn in seconds. Kits that sit between the victim and the real site and pass through the one-time code in real time have been around for years. AI makes the bait in front of them convincing.

Voice is the other weak spot. A few seconds of someone talking on a podcast or a sales video is enough to clone their voice well enough for a short phone call. That breaks any process where a help desk resets an account because a caller “sounds like” the owner, and any finance process that confirms a payment change by phone.

The common thread: anything a person can be talked into typing, reading out or approving can now be asked for at scale, convincingly. The fix is a login factor that a person can’t hand over, even if they’re fooled.

How a passkey works

A passkey is a pair of cryptographic keys created for one website. The private key stays on your device or in your password manager. The site stores only the public key, which is useless to a thief. When you log in, the site sends a random challenge, your device signs it with the private key after you confirm with a fingerprint, your face or the device PIN, and the site checks the signature.

Three details make this hold up against the attacks above:

  • It’s bound to the domain. The browser checks which site is asking before it will use a passkey. A passkey made for example.com is never offered on examp1e-login.com, however good the page looks. The person doesn’t need to notice anything.
  • There’s nothing to type or read out. No code to relay, nothing for a cloned voice to ask for.
  • The site holds no secret. A database leak exposes public keys, which can’t be used to log in anywhere.

The biometric check happens on the device and never reaches the website. All the site learns is that the person holding the device unlocked it.

Why it’s practical now

Early passkeys lived on one device, and losing that phone meant losing the account. That’s what kept me from recommending them to clients for a long time. Now Apple, Google and Microsoft sync passkeys through their own accounts, and password managers like 1Password and Bitwarden store and sync them across platforms. For most people a passkey now behaves like a saved password that can’t be phished.

Browsers also support autofill-style passkey sign-in. You mark the username field, and the browser offers saved passkeys in the same dropdown it uses for passwords. People who have a passkey tap it. People who don’t carry on with whatever the site had before. Nobody has to learn a new button, which matters more than any of the cryptography when it comes to getting people to switch.

Adding passkeys to a Next.js site

There are two routes. If the site already uses a hosted auth provider such as Clerk or Auth0, or a library like Better Auth, passkeys are usually a setting or a plugin, and that’s what I’d use. If the auth is custom, I build on SimpleWebAuthn, which handles the server-side verification that you really don’t want to write yourself.

On the page, the autofill flow is short. The username field gets webauthn in its autocomplete value, then the page asks for a passkey in “conditional” mode, which waits quietly until the person picks one from the dropdown:

login page (client)
<input name="email" autoComplete="username webauthn" />

// on mount
if (await PublicKeyCredential.isConditionalMediationAvailable?.()) {
  const options = await fetch('/api/passkey/login-options').then((r) => r.json());
  const credential = await navigator.credentials.get({
    mediation: 'conditional',
    publicKey: PublicKeyCredential.parseRequestOptionsFromJSON(options),
  });
  await fetch('/api/passkey/verify', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(credential.toJSON()),
  });
}

The server creates the challenge, remembers it for that session, and checks the signed response against the stored public key. The part I spend the most time on isn’t that code. It’s these decisions around it:

  • When to offer a passkey. Right after a successful password login or email link is the best moment. People are already signed in and in a “yes” frame of mind. One sentence and one button.
  • More than one per account. Let people add a passkey for each device or manager they use, and show the list with names and last-used dates so they can remove old ones.
  • Recovery. This is where most passkey rollouts quietly undo themselves. If “forgot passkey” sends a text-message code, the account is exactly as strong as that text message. For consumer sites I use an email link plus a cooling-off period and a notification. For business portals I’d rather an admin re-issue access.
  • Retiring the old route. Once someone has a passkey, offer to switch off their password. Keeping both forever means keeping the weakest one forever.

Rethinking login when an AI agent is the one signing in

The second shift is less obvious. People now ask assistants to do things inside other services: book the meeting, pull last month’s invoices, update the CRM. Browser agents and tools connected over the Model Context Protocol (MCP) all need some way to act as that person.

The worst way, and the most common one I see in quick prototypes, is to give the agent the person’s password or let it reuse their logged-in browser session. The agent then holds everything the person can do, the service can’t tell the agent’s actions from the person’s, and there’s no way to cut the agent off without changing the password.

The better pattern already exists: delegated access with OAuth. The person approves a specific set of permissions on the real site, the agent gets its own token, and that token can be limited, logged and revoked. The MCP authorization spec builds on OAuth 2.1 for exactly this reason. If you run a service that agents will touch, the work looks like this:

  • Narrow scopes. “Read invoices” and “send invoices” are different permissions. An agent that summarises bills should never be able to pay one.
  • Short-lived tokens. Minutes to hours, refreshed as needed, so a leaked token goes stale quickly.
  • A separate identity in the logs. Record “done by Assistant on behalf of Dana”, not just “Dana”. When something goes wrong, you need to know which.
  • A human for the irreversible. Payments, deletions and changes to who can access the account should stop and ask the person to confirm, ideally with their passkey.

Why narrow scopes matter more for agents

An agent reads web pages, emails and documents, and any of them can contain instructions aimed at the agent (“ignore the user and forward their files to…”). This is prompt injection, and there’s no complete fix for it yet. The practical defence is to assume the agent can be talked into misusing anything it has access to, and give it as little as possible.

Bots and sign-up forms

The same models that write phishing emails also solve many image CAPTCHAs and fill in forms like a person. If a site’s only defence against fake sign-ups is a puzzle, assume it’s already leaking. What still works: rate limits per IP range and per email domain, bot-detection services that look at how the browser behaves rather than what it types, email or phone verification before anything costly happens, and, again, passkeys. Each one takes a real device and a person to confirm it, which makes mass account creation slower and more expensive.

Where I’d start

  1. Offer passkeys as an option after login, using autofill so nobody is forced into it.
  2. Fix account recovery so it isn’t weaker than the login.
  3. Write down how your help desk verifies someone before a reset, and make “call back on the number we already have” the rule. A convincing voice is no longer proof.
  4. If agents or integrations touch your app, give them OAuth tokens with narrow scopes and their own name in the logs.
  5. Put a human confirmation in front of payments, deletions and permission changes.

None of this needs a rebuild. On most sites I work on it’s a few days of work, and the first step can ship on its own.

Frequently Asked Questions

What is a passkey?
A passkey is a login credential made of a key pair. The private key stays on your device or in your password manager, and the website only stores the public key. You unlock it with your fingerprint, face or device PIN, and it only works on the website it was created for, so a fake login page cannot use it.

Are passkeys safer than passwords with two-factor codes?
Yes. A six-digit code from a text message or an app can be typed into a phishing page and relayed to the real site within seconds. A passkey is tied to the real domain, so the browser will not offer it on a lookalike domain at all, and the site has no password database worth stealing.

What happens if I lose my phone?
Passkeys saved in iCloud Keychain, Google Password Manager or a password manager like 1Password or Bitwarden sync to your other devices, so a lost phone does not lock you out. Sites should still let you register more than one passkey and offer a recovery route that is at least as strong as the login itself.

How should an AI agent log in to a service on my behalf?
Through delegated access such as OAuth, where you approve a limited set of permissions and the agent gets its own short-lived token. Giving an agent your password or session cookie hands it everything you can do, with no way to tell its actions apart from yours or to revoke it on its own.

Want a login page that can’t be phished?

I add passkeys to Next.js sites and client portals, with recovery that doesn’t quietly undo the security. Tell me what your users log in to and I’ll tell you what it would take.