From c0ef77b6b8858051241e29ae332384b29e1eef63 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Thu, 19 Feb 2026 01:46:26 +0000 Subject: [PATCH] Broaden WebAuthn error handling to show register form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/components/AuthButton.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/AuthButton.tsx b/src/components/AuthButton.tsx index 146259f..e47c4f9 100644 --- a/src/components/AuthButton.tsx +++ b/src/components/AuthButton.tsx @@ -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');