Reset user password using admin account programatically or auth as a user using admin credentials? #5007
-
Hi, I am trying to either programatically reset the password of a user or auth as the user without a password using the admin credentials, is this possible with the js-sdk? I am trying to somehow get magic links to work and I want to either reset the password to be the key to the magic link or to have a field being the otp and then authing as the user. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not entirely sure that I understand the last part and how it is related to your question. In general if you are authenticated as admin you should be able to directly modify the user password without providing the old password: await pb.admins.authWithPassword("test@example.com", "1234567890")
// change the password of some user by its id
// (if you don't have an id you can send a separate getFirstListItem request)
await pb.collection("users").update("USER_ID", {
password: "new_pass",
passwordConfirm: "new_pass",
}) |
Beta Was this translation helpful? Give feedback.
I'm not entirely sure that I understand the last part and how it is related to your question.
In general if you are authenticated as admin you should be able to directly modify the user password without providing the old password: