mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 12:27:44 +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>
|
</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
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user