You can use Firebase Authentication to let your users authenticate with Firebase using their email addresses and passwords, and to manage your app's password-based accounts.
In this example, we use these steps to set it up for our Android project which is based on JavaScript.
But before doing so, this is what needs to get done before:
There are 2 auth methods required to create a password based user with displayName, namely .createUserWithEmailAndPassword and .updateProfile. I have nested the latter and created a single function which fires both of these methods for ease of use.
function registerPasswordUser(email,displayName,password,photoURL){
var user = null;
//NULLIFY EMPTY ARGUMENTS
for (var i = 0; i < arguments.length; i++) {
arguments[i] = arguments[i] ? arguments[i] : null;
}
auth.createUserWithEmailAndPassword(email, password)
.then(function () {
user = auth.currentUser;
user.sendEmailVerification();
})
.then(function () {
user.updateProfile({
displayName: displayName,
photoURL: photoURL
});
})
.catch(function(error) {
console.log(error.message,7000);
});
console.log('Validation link was sent to ' + email + '.');
}