I currently have a function that creates a user account. I would also like to add a username field, but I cannot figure out how to update it. I noticed in the Google console that there is a displayName field that is set to null. I do not know how to change this. 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;
});
} else {}
});
}
user6735919
source
share