113
rated 0 times
[
119]
[
6]
/ answers: 1 / hits: 57047
/ 8 Years ago, wed, november 2, 2016, 12:00:00
According to the JS Auth documentation on the Firebase website, it only shows how to get the displayName and how to update displayName. So I tried to update it. But it is sort of not logical, because how can you update something without creating it.
So my question here is, how can I set displayName of user during registeration?
function createUser(email, password) {
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function (error) {
error.message.replace(., );
alert(error.message + ( + error.code + ));
document.getElementById(password).value = ;
});
if (firebase.auth().currentUser != null) {
firebase.auth().currentUser.updateProfile({
displayName: document.getElementById(name).value
}).then(function () {
console.log(Updated);
}, function (error) {
console.log(Error happened);
});
}
}
I have already tried this and it has been proven not to work...
Sincerely,
Farouk
More From » firebase