Prompt
Why is my webauthn passkey setup failing in Safari?
Latest observation
Safari passkey setup failures usually come from one of a few common WebAuthn / Passkeys mismatches. The most likely causes are:
1) Your site is not considered a secure context
Passkeys require HTTPS (or localhost in development).
If Safari doesn’t see a secure origin, WebAuthn creation can fail.
2) RP ID / origin mismatch
The relying party ID must match the site’s domain rules exactly.
Examples:
- If your site is
https://login.example.com, the RP ID can usually beexample.comorlogin.example.com - It cannot be a totally unrelated domain
- It must match what Safari expects for the current origin
A mismatch here is one of the most common causes.
3) Challenge or options are malformed
Safari can be stricter about WebAuthn ceremony data. Check:
challengeis a Uint8Array / ArrayBuffer, not a stringuser.idis binary data, not a plain stringexcludeCredentialsandallowCredentialsIDs are binarypubKeyCredParamsincludes supported algorithms, usually:-7for ES256- sometimes
-257for RS256
timeoutis reasonable
4) Missing required user verification / authenticator selection issues
If you set options like:
authenticatorSelection.userVerificationresidentKeyrequireResidentKey
Safari may reject the request if the authenticator or platform doesn’t support the combination you requested.
5) You’re using unsupported browser/API behavior
Older Safari versions and some iOS/macOS combinations have quirks with:
- conditional UI / autofill passkeys
- cross-device passkeys
- certain attachment preferences
- silent mediation / discoverable credentials
6) You’re passing the wrong rp.name, user.name, or user.displayName
These should be sane, non-empty strings. Weird values usually don’t break creation, but bad formatting can lead to confusing errors.
7) Cookie/session or backend state mismatch
If your server generates challenge/options and then validates with different session state, Safari may just surface a generic failure. Make sure:
- the challenge stored server-side matches what you verify
- the ceremony isn’t expiring too quickly
- you aren’t regenerating the challenge between request and response
8) iCloud Keychain / Passkeys are not enabled or available
On Apple devices, passkeys depend on:
- iCloud Keychain being enabled
- Safari/WebAuthn support being available
- device passcode / Face ID / Touch ID setup
If these aren’t available, passkey creation can fail or fall back poorly.
9) CORS / request shape issues in your backend
If your frontend fetches registration options from your backend, ensure:
- JSON is returned correctly
- no accidental stringification of binary fields
- no middleware altering base64/base64url data
- registration response is decoded properly before
navigator.credentials.create()
What to check first
If you want the fastest path to debugging, inspect these in order:
- Console error from Safari
- Network response for your registration options
- Exact WebAuthn
PublicKeyCredentialCreationOptions - RP ID vs current domain
- Whether binary fields are encoded/decoded correctly
Common Safari-specific gotchas
user.idmust be binary, not a UUID string unless you convert itchallengemust be binaryexcludeCredentials[].idmust be binaryrp.idmust match the effective domain- Safari can be picky about conditional/passkey autofill depending on version
If you want, paste this and I can pinpoint it
Send me:
- the Safari error message
- your
navigator.credentials.create(...)options - your site domain and
rp.id - the Safari version / macOS or iOS version
…and I can tell you the exact likely cause.