Abhishek Buchake
Abhishek Buchake

Reputation: 31

How to check email id is valid in Firebase?

I used Firebase authentication in my android app. But in registration if I entered [email protected] it accept it successfully and also login the user successfully. But [email protected] in not real id. What is the way to check email id entered is really exist . e.g. [email protected] . This is my id provided by gmail. Please suggest

Upvotes: 3

Views: 376

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80914

To verify the email address using firebase, you can use the method sendEmailVerification():

FirebaseAuth auth = FirebaseAuth.getInstance();
FirebaseUser user = auth.getCurrentUser();

user.sendEmailVerification()
    .addOnCompleteListener(new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful()) {
                Log.d(TAG, "Email sent.");
            }
        }
    });

more info here:

https://firebase.google.com/docs/auth/android/manage-users#send_a_user_a_verification_email

https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser.html#sendEmailVerification()

Upvotes: 4

Related Questions