mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 04:19:20 +00:00
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:
@@ -107,6 +107,10 @@ type addPasskey = {
|
||||
```
|
||||
</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
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export const getPasskeyActions = (
|
||||
"/passkey/generate-authenticate-options",
|
||||
{
|
||||
method: "POST",
|
||||
throw: false,
|
||||
},
|
||||
);
|
||||
if (!response.data) {
|
||||
@@ -56,6 +57,7 @@ export const getPasskeyActions = (
|
||||
...opts?.fetchOptions,
|
||||
...options,
|
||||
method: "POST",
|
||||
throw: false,
|
||||
});
|
||||
$listPasskeys.set(Math.random());
|
||||
$store.notify("$sessionSignal");
|
||||
@@ -110,8 +112,10 @@ export const getPasskeyActions = (
|
||||
name: opts.name,
|
||||
}),
|
||||
},
|
||||
throw: false,
|
||||
},
|
||||
);
|
||||
|
||||
if (!options.data) {
|
||||
return options;
|
||||
}
|
||||
@@ -130,7 +134,9 @@ export const getPasskeyActions = (
|
||||
name: opts?.name,
|
||||
},
|
||||
method: "POST",
|
||||
throw: false,
|
||||
});
|
||||
|
||||
if (!verified.data) {
|
||||
return verified;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user