From 32db33a2600f20bf5d95e44e32f89c39c8c9911f Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:00:19 +0800 Subject: [PATCH] docs: pass token in reset-password (#1237) --- demo/nextjs/app/(auth)/reset-password/page.tsx | 1 + docs/content/docs/authentication/email-password.mdx | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/demo/nextjs/app/(auth)/reset-password/page.tsx b/demo/nextjs/app/(auth)/reset-password/page.tsx index d950e427..1f8f757a 100644 --- a/demo/nextjs/app/(auth)/reset-password/page.tsx +++ b/demo/nextjs/app/(auth)/reset-password/page.tsx @@ -29,6 +29,7 @@ export default function ResetPassword() { setError(""); const res = await client.resetPassword({ newPassword: password, + token: new URLSearchParams(window.location.search).get("token")!, }); if (res.error) { toast.error(res.error.message); diff --git a/docs/content/docs/authentication/email-password.mdx b/docs/content/docs/authentication/email-password.mdx index 2c9f1522..e022e9b5 100644 --- a/docs/content/docs/authentication/email-password.mdx +++ b/docs/content/docs/authentication/email-password.mdx @@ -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. ```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({ newPassword: "password1234", + token, }); ```