I have a sign up form for my react app using firebase auth.
The sign up function works great, it is just not sending a verification email. This is the code I am using:
const registerUser = async (email, name, password) => {
try {
console.log("> Registering user")
setLoading(true);
const {
user
} = await createUserWithEmailAndPassword(auth, email, password)
console.log("> Updating profile")
await updateProfile(user, {
displayName: name,
})
.then(()=>{
// send verification mail.
sendEmailVerification(auth.currentUser.email);
auth.signOut();
alert("Email sent");
})
.catch(alert);
window.location.pathname = `/subscriptions/${user.uid}`;
} catch (e) {
console.log(e)
}
setLoading(false)
};
The alert("Email sent") works fine, and it has sent a verification email in the past. I changed it since then however and can't remember what I used to make it send the verification email.