Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if given email exists

Is there a way to know if the email entered by user is real in Firebase? Does the built-in sign up with email&password method have this feature?

EDIT: sorry for the misunderstanding . I don't care if the email has been used before , what I need to know is: if the entered email is 'made-up' or 'real , exists'


1 Answers

This is another solution without any create user or sign in processes.

//check email already exist or not.
    firebaseAuth.fetchSignInMethodsForEmail(email)
            .addOnCompleteListener(new OnCompleteListener<SignInMethodQueryResult>() {
                @Override
                public void onComplete(@NonNull Task<SignInMethodQueryResult> task) {

                    boolean isNewUser = task.getResult().getSignInMethods().isEmpty();

                    if (isNewUser) {
                        Log.e("TAG", "Is New User!");
                    } else {
                        Log.e("TAG", "Is Old User!");
                    }

                }
            });
like image 178
J.Dragon Avatar answered Sep 09 '25 05:09

J.Dragon