firebase change email address 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: update photoURL firebase

this.$fireAuth.currentUser.updateProfile({
    displayName: '',
    photoURL: '',
    email: ''
  })
  .then((r) => {
    console.log(r)
  })
  .catch((e) => {
  console.log(e)
})

Example 3: change firebase email on login

firebase.auth()
    .signInWithEmailAndPassword('[email protected]', 'correcthorsebatterystaple')
    .then(function(userCredential) {
        userCredential.user.updateEmail('[email protected]')
    })

Tags:

Misc Example