fix: WebAuthn config typo and improve error handling
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 1m41s
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 1m41s
- Fix WEBAUTHN_ORIGIN -> WEBAUTHN_ORIGINS env var name - Add null check for cancelled passkey creation - Use finally block to ensure loading state is always reset - Add console.error for better debugging
This commit is contained in:
@@ -49,6 +49,9 @@
|
||||
opts.excludeCredentials = opts.excludeCredentials.map(c => ({ ...c, id: base64urlToBuffer(c.id) }));
|
||||
}
|
||||
const cred = await navigator.credentials.create({ publicKey: opts });
|
||||
if (!cred) {
|
||||
throw new Error("Passkey creation was cancelled");
|
||||
}
|
||||
const name = prompt("Name this passkey (e.g. MacBook, iPhone):", "Passkey") || "Passkey";
|
||||
const body = {
|
||||
id: cred.id,
|
||||
@@ -64,9 +67,11 @@
|
||||
passkeyMsg = "Passkey registered successfully";
|
||||
await loadPasskeys();
|
||||
} catch (e) {
|
||||
console.error("Passkey registration error:", e);
|
||||
passkeyErr = e.body?.detail || e.message || "Failed to register passkey";
|
||||
} finally {
|
||||
passkeyLoading = false;
|
||||
}
|
||||
passkeyLoading = false;
|
||||
}
|
||||
|
||||
async function clearPasskeys() {
|
||||
|
||||
Reference in New Issue
Block a user