[GH-ISSUE #4454] Allow an admin to set a user password #9936

Closed
opened 2026-04-13 05:45:50 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @maelp on GitHub (Sep 5, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4454

Is this suited for github?

  • Yes, this is suited for github

Is your feature request related to a problem? Please describe.

Right now, auth.api.setPassword requires the current user session to be given, in order to allow the user to change his password.

But there are cases (like seeding user in test database, or providing an ad-hoc mechanism to set initial passwords by the admin) where we would want to have a setPassword({userId, newPassword}) (only accessible in the backend)

Describe the solution you'd like

Allow setPassword to be called with a userId as parameter (and not using the user in the current session — which might not exist when running from an automated script)

Describe alternatives you've considered

Re-implement the creation of the corresponding account, but this is error-prone

Additional context

No response

Originally created by @maelp on GitHub (Sep 5, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4454 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Right now, `auth.api.setPassword` requires the current user session to be given, in order to allow the user to change his password. But there are cases (like seeding user in test database, or providing an ad-hoc mechanism to set initial passwords by the admin) where we would want to have a `setPassword({userId, newPassword})` (only accessible in the backend) ### Describe the solution you'd like Allow setPassword to be called with a `userId` as parameter (and not using the user in the current session — which might not exist when running from an automated script) ### Describe alternatives you've considered Re-implement the creation of the corresponding account, but this is error-prone ### Additional context _No response_
GiteaMirror added the enhancementlocked labels 2026-04-13 05:45:50 -05:00
Author
Owner

@ping-maxwell commented on GitHub (Oct 6, 2025):

we have auth.api.setUserPassword which does this

<!-- gh-comment-id:3371695550 --> @ping-maxwell commented on GitHub (Oct 6, 2025): we have auth.api.setUserPassword which does this
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9936