[GH-ISSUE #803] API function to verify password #8444

Closed
opened 2026-04-13 03:30:52 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @JE4GLE on GitHub (Dec 7, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/803

Is your feature request related to a problem? Please describe.
Currently, I cannot verify the password on the server side to authenticate actions. For example, "Enter your password to delete this item".

Describe the solution you'd like

const isCorrect: boolean = await auth.api.verifyPassword({
    password,
});

Describe alternatives you've considered
Manually getting the data from the database and verifying it. This is somewhat hacky and I would not prefer it.

Originally created by @JE4GLE on GitHub (Dec 7, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/803 **Is your feature request related to a problem? Please describe.** Currently, I cannot verify the password on the server side to authenticate actions. For example, "Enter your password to delete this item". **Describe the solution you'd like** ```javascript const isCorrect: boolean = await auth.api.verifyPassword({ password, }); ``` **Describe alternatives you've considered** Manually getting the data from the database and verifying it. This is somewhat hacky and I would not prefer it.
GiteaMirror added the locked label 2026-04-13 03:30:52 -05:00
Author
Owner

@JE4GLE commented on GitHub (Dec 7, 2024):

Nice would be an option to add it as a password entry try to limit requests. For example:

const isCorrect: boolean = await auth.api.verifyPassword({
    password,
    limited: true
});

With limited having false as a default value.

<!-- gh-comment-id:2525235576 --> @JE4GLE commented on GitHub (Dec 7, 2024): Nice would be an option to add it as a password entry try to limit requests. For example: ```javascript const isCorrect: boolean = await auth.api.verifyPassword({ password, limited: true }); ``` With `limited` having `false` as a default value.
Author
Owner

@Bekacru commented on GitHub (Dec 8, 2024):

you can use the ctx api (which isn't documented yet)

const ctx = await auth.$context;
await ctx.password.verify({password: "", hash: ""});

It should be documented soon

<!-- gh-comment-id:2525430542 --> @Bekacru commented on GitHub (Dec 8, 2024): you can use the ctx api (which isn't documented yet) ```ts const ctx = await auth.$context; await ctx.password.verify({password: "", hash: ""}); ``` It should be documented soon
Author
Owner

@SaviruFr commented on GitHub (Dec 3, 2025):

Hey @Bekacru, any chance we could still get something like auth.api.verifyPassword?

<!-- gh-comment-id:3608269314 --> @SaviruFr commented on GitHub (Dec 3, 2025): Hey @Bekacru, any chance we could still get something like auth.api.verifyPassword?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8444