[GH-ISSUE #284] Error while reset password #16833

Closed
opened 2026-04-15 14:49:41 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @rachhen on GitHub (Oct 21, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/284

Describe the bug
When I want to reset the password it response the bad request token is undefined. but in the authClient.resetPassword it doesn't have the token field object. the page that reset password access vai the link get from email.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the email and click the reset password link, and it redirect to reset password page
  2. Enter the new password
  3. Click reset password
  4. It response the bad request token undefined

Expected behavior
I should be reset password successful and redirect to login page.

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version 0.5.2-beta.17

Additional context

This is the URL that redirect from the email link: http://localhost:3000/reset-password?token=XtV4sYZVsxFYlMFKGFL4m

The error response while request reset password:

{
    "message": "[\n  {\n    \"code\": \"invalid_type\",\n    \"expected\": \"string\",\n    \"received\": \"undefined\",\n    \"path\": [\n      \"token\"\n    ],\n    \"message\": \"Required\"\n  }\n]",
    "details": [
        {
            "code": "invalid_type",
            "expected": "string",
            "received": "undefined",
            "path": [
                "token"
            ],
            "message": "Required"
        }
    ]
}
Originally created by @rachhen on GitHub (Oct 21, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/284 **Describe the bug** When I want to reset the password it response the bad request `token` is undefined. but in the `authClient.resetPassword` it doesn't have the `token` field object. the page that reset password access vai the link get from email. **To Reproduce** Steps to reproduce the behavior: 1. Go to the email and click the reset password link, and it redirect to reset password page 2. Enter the new password 3. Click reset password 4. It response the bad request token undefined **Expected behavior** I should be reset password successful and redirect to login page. **Screenshots** <img width="677" alt="image" src="https://github.com/user-attachments/assets/7c721840-8ddb-4093-b40e-126a94d9cde7"> **Desktop (please complete the following information):** - OS: MacOS - Browser: Chrome - Version 0.5.2-beta.17 **Additional context** This is the URL that redirect from the email link: http:\/\/localhost:3000/reset-password?token=XtV4sYZVsxFYlMFKGFL4m The error response while request reset password: ```ts { "message": "[\n {\n \"code\": \"invalid_type\",\n \"expected\": \"string\",\n \"received\": \"undefined\",\n \"path\": [\n \"token\"\n ],\n \"message\": \"Required\"\n }\n]", "details": [ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "token" ], "message": "Required" } ] } ```
GiteaMirror added the locked label 2026-04-15 14:49:41 -05:00
Author
Owner

@Bekacru commented on GitHub (Oct 21, 2024):

The reset password action expects a token query parameter in the URL. If you're implementing a custom flow, you'll need to supply the token yourself. I’ve just opened a PR to address cases where the token parameter isn't being properly read from the URL. If this doesn't solve the issue make sure to pass the token manually.

<!-- gh-comment-id:2427432080 --> @Bekacru commented on GitHub (Oct 21, 2024): The reset password action expects a `token` query parameter in the URL. If you're implementing a custom flow, you'll need to supply the token yourself. I’ve just opened a PR to address cases where the `token` parameter isn't being properly read from the URL. If this doesn't solve the issue make sure to pass the token manually.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16833