I created a function to create a new user with the following code, which creates the user and changes their displayName:
export function handleSignup(email, password, name) {
firebase_auth.createUserWithEmailAndPassword(email, password)
.then(function(reponse) {
reponse.user.updateProfile({displayName: username});
})
.catch(function(error) {
// Handle error
});
}
The problem is that anyone can make the same username, it doesn't check for uniqueness. Is there a way for me to request a user by displayName and see if it already exists before attempting to create the new user?