I am using expo client for my app. When I send the email, the verification immediately fails. When I go to the email and verify it, the verification still doesn’t work. This is my function:
firebase.auth().createUserWithEmailAndPassword(emailID, password)
.then(async ({user}) =>{
//console.log(this.state)
await user.sendEmailVerification().then(async() => {
user = await firebase.auth().currentUser;
await user.reload();
user = await firebase.auth().currentUser;
if(user.emailVerified) {
db.collection("Users").add({
'firstName': this.state.firstName,
'lastName': this.state.lastName,
'contact': this.state.contact,
'emailID': this.state.emailID,
'password': this.state.password,
'description': '',
'profilePicture': ''
})
return alert('Account has been created. You can now login.');
} else {
return alert('Failed to verify email!')
}
})
})
.catch((error) => {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
return alert(errorMessage);
});
Can anyone please provide me a solution for this? Thanks,