I send email verification and click the link. Then I call isEmailVerified()
on FirebaseUser
object. This always return null
, what may be the reason?

- 2,938
- 2
- 12
- 17
9 Answers
You should refresh the user object after verification as follows :
usertask = mAuth.getCurrentUser().reload();
usertask.addOnSuccessListener(new OnSuccessListener() {
@override
public void onSuccess(Void aVoid) {
user = mAuth.getCurrentUser();
boolean useremailveri = user.isEmailVerified();
String useremailuid = user.getUid();
}
});

- 2,295
- 3
- 28
- 31
First you have to call this method : signInWithEmailAndPassword
, at least 1 time after user has verified their email ....
Only after that, you will get isEmailVerified()
as true

- 4,452
- 10
- 23
- 47

- 106
- 2
- 2
Change isEmailVerified()
to emailVerified;

- 3,226
- 5
- 16
- 43

- 21
- 1
-
This method is not available in FirebaseUser – PRANAV SINGH Jun 25 '21 at 09:49
Re-authenticates the user who updates if the email has been verified ...
https://firebase.google.com/docs/auth/android/manage-users#re-authenticate_a_user

- 1,545
- 20
- 31
Same technique as @yehyatt´s solution but easier. Sign the user in with firebase, refresh the user and then check if the user is verified.
Sign the user In
Auth.auth().signIn(withEmail: YourEMail, password: YourPassword) { result, error in if error != nil { logInErrorReason = "\(error!.localizedDescription)" // An error ocurred }else { // Handle successful login. } }
Refresh current user:
Auth.auth().currentUser?.reload(completion: ((Error?) -> Void)?)
Check if he is signed in:
if Auth.auth().currentUser?.isEmailVerified == true { // Handle successful verification}

- 30,962
- 25
- 85
- 135

- 320
- 3
- 10
I think you need to first login with user's Email and Password using signInWithEmailAndPassword
then try calling isEmailVerified()
method on returning user.

- 2,196
- 2
- 21
- 38
-
2That's not necessary. If the new account was created, the user is also signed in. As @yehyatt said, you just need to reload the current user. – Rupam Das Feb 18 '18 at 07:10
isEmailVerified
should provide correct response, however you might be using it incorrectly.
- If user verified his email ( he/she received an email from firebase, and clicked on "verify email" link ) then it will return true;
- If user didn't verified his email - it will return false
So solution for this issue is to update you registration process.
When you create new user you should also issue a command to start email verification process await user.sendEmailVerification();
once your user will receive an email and will verify it. your method : user.isEmailVerified
will return true
Your registration process should look something like that:
AuthResult result = await _auth.createUserWithEmailAndPassword(
email: email,password: password);
FirebaseUser user = result.user;
await user.sendEmailVerification();

- 210
- 1
- 5
- Create new user using createUserWithEmailAndPassword
- Let it send verification link to your gmail using sendEmailVerification
- go to your own gmail, you will see verification link and just click on that link
- try to login with username and email
You will see your own account had already verified and can proceed next setps

- 17
- 6
I use something like this. It returns the local value if the local value is true (since once verified it should never get unverified), else it refreshes the user and returns the updated value.
var isEmailVerified: Bool {
get async {
if Auth.auth().currentUser?.isEmailVerified == true {
return true
}
try? await Auth.auth().currentUser?.reload()
return Auth.auth().currentUser?.isEmailVerified == true
}
}

- 2,562
- 1
- 18
- 11