0

Is there any way to check email is verified or not before the login. I am sending verification links through Firebase email authentication its work successfully. But I tried to check is Email verified or not.

final FirebaseUser user = firebaseAuth.getCurrentUser();
                if (user.isEmailVerified()) {
                    firebaseAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                        @Override
                        public void onComplete(@NonNull Task<AuthResult> task) {
                            if (task.isSuccessful()) {

                            }
                        }
                    }).addOnFailureListener(new OnFailureListener() {
                        @Override
                        public void onFailure(@NonNull Exception e) {
                            Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
                        }
                    });
                } else {
                    Toast.makeText(getActivity(), "Please verify your email!", Toast.LENGTH_SHORT).show();
                }
            }
        });
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • 1
    Possible duplicate? [Firebase Authentication: Verify email before sign up](https://stackoverflow.com/questions/49708624/firebase-authentication-verify-email-before-sign-up) – RJB May 02 '20 at 21:04

1 Answers1

0

As far as I know, the user needs to be signed in. There is no other way to get a User object so that you can call the isEmailVerified method on it.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441