fix(passkey): graceful skip on cancel / no-passkey#60
Merged
Conversation
The "Sign in with a passkey" button is always shown when the browser supports WebAuthn - including for users who have no passkey - so a cancel or an account-with-no-passkey (both surface as NotAllowedError/AbortError) was showing a red "cancelled or failed" error. Treat those as a silent skip so the user just falls back to password/social login; only surface real failures.
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the "Sign in with a passkey" button fail gracefully so a passkey-less user is never trapped or shown a scary error.
Problem
The passkey button renders whenever the browser supports WebAuthn — which includes users who have no passkey (there's no pre-auth way to know, by design). Clicking it then cancelling, or having no credential, both surface as
NotAllowedError/AbortError, which the component showed as a red "Passkey login was cancelled or failed" banner.Fix
Treat
NotAllowedError/AbortErroras a silent skip (user falls back to password/social/magic-link) instead of an error. Only genuine failures (network, verification) show a message. The browser deliberately doesn't distinguish "cancelled" from "no credential" to avoid leaking account state, so both are handled the same way.Uses the SDK's existing
error.code(already in the published types) — no dependency bump required, ships independently.Verification
tsc --noEmit+tsupbuild pass.Part of the passkey-login UX set alongside authorizer-js#43 (autofill SDK) and authorizer-react#59 (autofill wiring).