Saturday, May 11, 2024
 Popular · Latest · Hot · Upcoming
114
rated 0 times [  121] [ 7]  / answers: 1 / hits: 69077  / 8 Years ago, fri, october 7, 2016, 12:00:00

I am trying to change/update a user's email address using :



firebase.auth().changeEmail({oldEmail, newEmail, password}, cb)


But I am getting ...changeEmail is not a function error. I found the reference here from the old firebase docu.



So how to I do it in the 3.x version? Because I cant find a reference in the new documentation.


More From » firebase

 Answers
86

You're looking for the updateEmail() method on the firebase.User object: https://firebase.google.com/docs/reference/js/firebase.User#updateEmail


Since this is on the user object, your user will already have to be signed in. Hence it only requires the password.


Simple usage:


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

[#60472] Wednesday, October 5, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
emiliano

Total Points: 381
Total Questions: 109
Total Answers: 93

Location: Jersey
Member since Fri, Oct 1, 2021
3 Years ago
emiliano questions
;