firebase auth reset password code example

Example 1: how to change user password firebase

var user = firebase.auth().currentUser;
var newPassword = getASecureRandomPassword();

user.updatePassword(newPassword).then(function() {
  // Update successful.
}).catch(function(error) {
  // An error happened.
});

Example 2: firebase forget password

It sounds like you're looking to send a password reset email. See this example from the Firebase documentation:

FirebaseAuth.getInstance().sendPasswordResetEmail("[email protected]")
    .addOnCompleteListener(new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful()) {
                Log.d(TAG, "Email sent.");
            }
        }
    });

Example 3: reset password firebase auth

var auth = firebase.auth();
var emailAddress = "[email protected]";
auth.sendPasswordResetEmail(emailAddress)
.then(function() {  
// Email sent.
})
.catch(function(error) {
// An error happened.
});

Example 4: firebase reset password javascript

To implement a forgot password button, you have to call: firebase.auth().sendPasswordResetEmail('[email protected]')

Check the documentation for more details: https://firebase.google.com/docs/reference/js/firebase.auth.Auth#sendPasswordResetEmail

Tags:

Misc Example