I am trying to sendEmailVerification using Firebase but it’s failing.
const handleSubmit = (e) => {
e.preventDefault();
fetch("http://localhost:4000/auth/register", {
method: "POST",
body: JSON.stringify({
email,
password,
}),
headers: {
"Content-Type": "application/json",
},
})
.then((res) => {
return res.json()
}).then((data) => {
signInWithEmailAndPassword(auth, email, password);
}).then(() => {
console.log("data", auth.currentUser)
sendEmailVerification(auth.currentUser)
.then(() => {
navigate('/')
})
}).catch((err) => {
console.error(err);
});
};
It seems like there’a delay to sendEmailVerification. If I sign up user1, no email verification is sent, but after I sign up user2, user1 email is then sent. Why is there a delay? I want the user email verification to be immediately sent after registration.