Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

The authentication ceremony

A passkey sign-in proves that the private key behind a registered credential just signed something fresh, for this site, in this attempt. The server never sees the key. It checks a signature against the public key it stored at registration, and every value it compares is one it stored or chose itself.

Prove possession without sending the key

The next morning Ava opens Lab Photos' sign-in page at https://auth.photos.example, chooses Sign in with a passkey and touches the fingerprint reader. She never types her address. Behind that single touch, Lab Photos' server has to answer a precise question: did the private key that belongs to a credential it registered just sign something fresh, for this site, in this attempt?

Lab Photos cannot ask to see the key. It holds only what The registration ceremony stored: the credential ID, the public key, the user handle and the last signature counter. So it sends a new challenge and asks the authenticator to sign it. A valid signature over that challenge proves possession without anything secret crossing the network, and the checks around the signature make sure the proof is for this sign-in and nothing else.

The signed answer the authenticator returns is called an assertion. The same three parties take part as at registration: Lab Photos' server as the relying party, Ava's browser as the client, and the authenticator that holds her passkey.

A discoverable passkey sign-in at Lab Photos. The server finds the account from the credential ID and user handle, compares only values it stored or chose itself, and creates no session when any of them does not fit.

The request options

Registration began with creation options passed to navigator.credentials.create(). A sign-in begins the same way with a different call: the sign-in page asks the server for request options and passes them to navigator.credentials.get(). They are much shorter than the creation options, because nothing new is being made:

json
{
  "challenge": "Vb3qT9mXe2LkR7uNw4ZsY1oCh8fAjD6gPi0Ht5EyKcM",
  "rpId": "photos.example",
  "allowCredentials": [],
  "userVerification": "required",
  "timeout": 300000
}

The server saves the challenge with its purpose (sign-in), a deadline five minutes away to match timeout, and the browser it was sent to, usually by setting a short-lived cookie with the options. rpId names the relying party whose credentials may answer, under the same rule as at registration: it must be the page's own host or a registrable parent of it, so auth.photos.example may ask for photos.example.

allowCredentials is empty, and that is what makes this a discoverable sign-in. The server does not yet know who is signing in, so it lets the authenticator offer any credential it holds for photos.example. This is why Ava registered a discoverable credential: her authenticator can find it without being told its ID. If she has two Lab Photos accounts on the same device, the browser shows both names and lets her choose.

The other style starts with the account. If Ava typed her address first, Lab Photos could look up her credentials and list their IDs, each with its transports, the ways the browser can reach that authenticator (internal for one built into the device, hybrid for a phone nearby, usb and nfc for a security key):

json
"allowCredentials": [
  { "type": "public-key", "id": "i6Jq4RxkGkJdNqP6j3mrFw", "transports": ["internal", "hybrid"] },
  { "type": "public-key", "id": "Kq3w9xY2bVd1nRtE7uLs0A", "transports": ["usb", "nfc"] }
]

This style also works with non-discoverable credentials, which the authenticator cannot find on its own, such as a security key registered as a second step: given the ID, the authenticator recognizes its own credential. But it tells anyone who types Ava's address which kinds of authenticator she has, which is one reason discoverable sign-in is the usual choice for passkeys.

What comes back

The browser builds clientDataJSON again, now with type set to webauthn.get, so this answer can never be passed off as a registration:

json
{
  "type": "webauthn.get",
  "challenge": "Vb3qT9mXe2LkR7uNw4ZsY1oCh8fAjD6gPi0Ht5EyKcM",
  "origin": "https://auth.photos.example",
  "crossOrigin": false
}

The authenticator finds Ava's credential, checks her fingerprint and produces the assertion. Its authenticator data is the short form, 37 bytes, because no new credential is being described: the 32-byte rpIdHash, a flags byte of 0x1d (UP and UV set, BE and BS set because her passkey syncs, AT clear) and a four-byte signCount. The authenticator then signs the authenticator data followed by the SHA-256 hash of clientDataJSON, using the private key it kept at registration. Ava's passkey is an ES256 key, so the signature is ECDSA with the P-256 curve. The page receives:

The assertion Ava's browser hands to Lab Photos' sign-in page, with binary values in base64url
FieldWhat it holds
idThe credential ID, i6Jq4RxkGkJdNqP6j3mrFw
clientDataJSONThe JSON above
authenticatorDataThe 37 bytes
signatureAn ECDSA signature over authenticatorData and the hash of clientDataJSON
userHandleP76oYjzHeIMH_he0IpY-elnmigO5e6ITTGrXPE5ttKY, the handle stored with the credential at registration

Because the signature covers both pieces, nothing in them can be changed without breaking it. The browser's statement of the challenge and origin and the authenticator's statement of the relying party and flags are bound together under one key. The userHandle is how a discoverable sign-in says whose account the credential belongs to; it is the random value Lab Photos chose for Ava's account, not her address.

Checking the assertion

Section 7.2 of the WebAuthn specification lists the server's steps, and a maintained WebAuthn library performs them. In the order Lab Photos performs them:

  1. Open the saved challenge for this browser. It must exist, be for a sign-in, be unused and be within its deadline.
  2. Look up the credential by id. If allowCredentials was not empty, the ID must be one of those listed. An unknown ID ends the attempt: the server has no public key to check the signature with, so a perfectly good signature from an unregistered key proves nothing.
  3. Identify the account. In a discoverable sign-in the credential record names its owner, and the returned userHandle must equal that owner's handle. In an account-first sign-in, the credential must belong to the account that was named.
  4. Decode clientDataJSON: type is webauthn.get, challenge equals the saved challenge and origin is one Lab Photos expects, here https://auth.photos.example.
  5. In the authenticator data, rpIdHash equals SHA-256 of photos.example, UP is set, UV is set if verification was required, and BS is not set without BE.
  6. Verify the signature over the authenticator data and the hash of clientDataJSON with the stored public key.
  7. Apply the signature counter rule, described below.

Then the server marks the challenge used, saves the new counter and the current BS flag, and only after all of that creates Ava's session.

Presence and verification in the flags

The UP and UV bits answer different questions. UP says someone was there: a touch on a security key, a tap on a prompt. UV says the authenticator checked that it was its owner, with a PIN, a pattern or a biometric. Ava's touch on the fingerprint reader produced both, so with BE and BS set for her synced passkey the flags byte reads 0x1d.

Suppose Lab Photos requires verification, but a security key that supports only touch answers instead. Its signature is genuine and its flags read 0x01. The browser normally stops this earlier, because userVerification: "required" tells it not to accept an answer without verification. The server checks the bit anyway, because it relies only on what is inside the signed data. A browser can be buggy or out of date, or a script can call the server directly without any browser; the flags cannot be changed without breaking the signature.

When UV is set, the authenticator has combined something Ava has, the device holding the key, with something she knows or is. That is why a verified passkey sign-in can count as two factors on its own, while a touch-only key is one factor. A sign-in that pairs a password with a touch-only key also uses two factors, the password and the key.

Signature counters

Registration stored a signCount of zero. An authenticator may increase that counter each time it signs, so the server can spot a cloned credential, a private key copied out of one authenticator into another: the two copies would count separately, and sooner or later one would report a counter lower than one the server has already seen. The rule in section 6.1.1 of the specification is simple. If the stored counter or the new one is not zero, the new one should be greater than the stored one. If it is not, the server cannot tell which copy is genuine, and it decides by policy what to do, from refusing the sign-in to recording a warning for review.

Ava's passkey syncs through her password manager and reports zero every time, as many do. A synced passkey lives on several devices at once, and a single counter cannot stay in order across them, so its provider reports zero. A counter of zero means the authenticator does not count, and the server must not treat it as a clone. In practice, counters help with some security keys that keep their key on one device and say nothing about synced passkeys, so they are evidence to record, not the defense that keeps a stolen key out.

One session for the intended account

Each check closes a different door. The consumed challenge means a captured assertion cannot be submitted again, even a minute later. The deadline means an assertion made and held for later is refused. The origin and rpIdHash mean an assertion made for another site never matches: a lookalike page at https://photos-login.example cannot even ask for a photos.example credential, because the browser refuses a relying party ID that is not the page's domain or a parent of it. The user handle and the credential record mean a valid signature from one person's passkey cannot open another person's attempt. If Ava's credential answers a sign-in that was started for Cora's account, the account in the attempt and the owner of the credential disagree, and the server refuses.

Two requests can arrive with the same assertion at the same moment, for example from a page that retries too eagerly. The server consumes the challenge in one atomic step, a single change that either happens completely or not at all, so only one of them can succeed. Every refused path ends without a session, and the person sees a short, general message rather than which check failed.

A successful assertion proves that Ava's authenticator took part in this sign-in for Lab Photos. It does not decide what she may do after signing in; the service's permissions do. And her account is only as strong as its weakest way in, so recovery and any remaining password path matter as much as the passkey.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Lab Photos requires user verification. An assertion for Ava's account arrives with a valid signature and the flags byte 0x01. What should the server do? 1 of 3

Choose one answer.

Ava's synced passkey reports signCount 0 at every sign-in. What should Lab Photos conclude? 2 of 3

Choose one answer.

A sign-in attempt is started for Cora's account, but the assertion that comes back is a valid one from Ava's registered passkey. What should Lab Photos do? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity