Broaden WebAuthn error handling to show register form
Catch SecurityError and AbortError in addition to NotAllowedError when login fails — all indicate the user needs to register rather than showing a cryptic error message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cdd04fe185
commit
c0ef77b6b8
|
|
@ -71,7 +71,9 @@ export function AuthButton() {
|
|||
try {
|
||||
await login();
|
||||
} catch (e: any) {
|
||||
if (e.name === 'NotAllowedError') {
|
||||
// Any WebAuthn error (NotAllowedError, SecurityError, AbortError)
|
||||
// should show register form — user likely has no passkey yet
|
||||
if (e.name === 'NotAllowedError' || e.name === 'SecurityError' || e.name === 'AbortError') {
|
||||
setShowRegister(true);
|
||||
} else {
|
||||
setError(e.message || 'Sign in failed');
|
||||
|
|
|
|||
Loading…
Reference in New Issue