mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 12:27:44 +00:00
docs: pass token in reset-password (#1237)
This commit is contained in:
@@ -29,6 +29,7 @@ export default function ResetPassword() {
|
|||||||
setError("");
|
setError("");
|
||||||
const res = await client.resetPassword({
|
const res = await client.resetPassword({
|
||||||
newPassword: password,
|
newPassword: password,
|
||||||
|
token: new URLSearchParams(window.location.search).get("token")!,
|
||||||
});
|
});
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
toast.error(res.error.message);
|
toast.error(res.error.message);
|
||||||
|
|||||||
@@ -213,8 +213,13 @@ When a user clicks on the link in the email, they will be redirected to the rese
|
|||||||
- `newPassword`: The new password of the user.
|
- `newPassword`: The new password of the user.
|
||||||
|
|
||||||
```ts title="auth-client.ts"
|
```ts title="auth-client.ts"
|
||||||
|
const token = new URLSearchParams(window.location.search).get("token");
|
||||||
|
if (!token) {
|
||||||
|
// Handle the error
|
||||||
|
}
|
||||||
const { data, error } = await authClient.resetPassword({
|
const { data, error } = await authClient.resetPassword({
|
||||||
newPassword: "password1234",
|
newPassword: "password1234",
|
||||||
|
token,
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user