1

I am using firebase authentication for my admin website. I know how to reset the password sending the reset password email. I am using that method in my client website. But I want my admin user to reset the password without sending the reset password since they already login. Just like using new password and confirm password form and submit to reset and login again. I don't want my admin user to send the reset password email.

May I know how to reset the firebase authentication without sending the reset password email?

2 Answers 2

2

You can use the updatePassword method that comes with firebase.

import { getAuth, updatePassword } from "firebase/auth";

const auth = getAuth();

const user = auth.currentUser;
const newPassword = getPWFromForm();

updatePassword(user, newPassword).then(() => {
  // Update successful.
}).catch((error) => {
  // An error ocurred
  // ...
});

You would create a textfield where the user enters their new password and then passes it to the updatePassword function.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for the answer. I don't know that there is updatePassword function under auth.
0

With the code in RyanY's answer you can update the password of the current user.

If you want to change the password of another user, you will need to use the Admin SDK in a trusted environment, such as your development machine, a server you control, or Cloud Functions/Cloud Run. With that SDK, you can update any properties of any user (including their password) by their UID.

1 Comment

I think both of ur answer are useful for me but I give the answer for RyanY since it is for current user. Yes, I will use Admin SDK to reset password for super admin to reset password for other. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.