197
rated 0 times
[
200]
[
3]
/ answers: 1 / hits: 33477
/ 8 Years ago, wed, september 21, 2016, 12:00:00
I currently have a function that creates a user account. I'd like to be able to add a username field too, but I can't seem to figure out how to update that. I noticed in the Google console, that there is a displayName field that is set to null. I don't know how to change it. This is what I have:
function create(email, password, username) {
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
$timeout(function() {
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode.toUpperCase() + : + errorMessage);
})
});
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
$timeout(function() {
console.log(Success! Account Created!);
user.displayName = username; /* this doesn't work*/
});
} else {}
});
}
More From » firebase