fix(passkey): passkey breaks with throw: true (#5079)

Co-authored-by: Bereket Engida <Bekacru@gmail.com>
Co-authored-by: Bereket Engida <86073083+Bekacru@users.noreply.github.com>
This commit is contained in:
Maxwell
2025-10-09 17:38:03 +10:00
committed by GitHub
parent 59653925b8
commit ba86dadf82
2 changed files with 10 additions and 0 deletions

View File

@@ -107,6 +107,10 @@ type addPasskey = {
``` ```
</APIMethod> </APIMethod>
<Callout>
Setting `throw: true` in the fetch options has no effect for the register and sign-in passkey responses — they will always return a data object containing the error object.
</Callout>
### Sign in with a passkey ### Sign in with a passkey

View File

@@ -36,6 +36,7 @@ export const getPasskeyActions = (
"/passkey/generate-authenticate-options", "/passkey/generate-authenticate-options",
{ {
method: "POST", method: "POST",
throw: false,
}, },
); );
if (!response.data) { if (!response.data) {
@@ -56,6 +57,7 @@ export const getPasskeyActions = (
...opts?.fetchOptions, ...opts?.fetchOptions,
...options, ...options,
method: "POST", method: "POST",
throw: false,
}); });
$listPasskeys.set(Math.random()); $listPasskeys.set(Math.random());
$store.notify("$sessionSignal"); $store.notify("$sessionSignal");
@@ -110,8 +112,10 @@ export const getPasskeyActions = (
name: opts.name, name: opts.name,
}), }),
}, },
throw: false,
}, },
); );
if (!options.data) { if (!options.data) {
return options; return options;
} }
@@ -130,7 +134,9 @@ export const getPasskeyActions = (
name: opts?.name, name: opts?.name,
}, },
method: "POST", method: "POST",
throw: false,
}); });
if (!verified.data) { if (!verified.data) {
return verified; return verified;
} }