Skip to content Skip to sidebar Skip to footer

Com.google.firebase.firebaseexception: An Internal Error Has Occurred. [ User_not_found ]

I have implemented Firebase authentication with email and password, here is my code mFirebaseAuth.createUserWithEmailAndPassword(edtEmail.getText().toString(), edtPassword.getText(

Solution 1:

I copied and ran your code with Firebase 9.6.1. When I passed an email address to createUserWithEmailAndPassword() that had never been used before, sendEmailVerification() completed successfully. I observed the failure you reported when I used an email address for a user that I had previously created and then deleted at the Firebase console. Are you seeing the failure when you use addresses you have used before and then deleted?

Note that createUserWithEmailAndPassword() not only creates the user, but also, if successful, signs the user in. When the creation and sign-in occurs when there is an existing signed-in user, there appears to be a Firebase bug related to signing out and clearing the cache for the previous user.

I was able to make your code work for a previously signed-in and later deleted user by calling signOut() before createUserWithEmailAndPassword().

Solution 2:

You should use AuthStateListener() to see when a user is signed in that will ensure that user has successfully created and logged in then you can verify your user.

privateFirebaseAuth.AuthStateListener mAuthListener;

 mAuthListener = newFirebaseAuth.AuthStateListener() {
        @OverridepublicvoidonAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null) {
                // User is signed inVerifyYourUserWithEmail(); 


            } else {
                // User is signed outLog.d(TAG, "onAuthStateChanged:signed_out");
            }
            // ...
        }
    };

@OverridepublicvoidonStart() {
    super.onStart();
    mAuth.addAuthStateListener(mAuthListener);
}

@OverridepublicvoidonStop() {
    super.onStop();
    if (mAuthListener != null) {
        mAuth.removeAuthStateListener(mAuthListener);
    }
}

Post a Comment for "Com.google.firebase.firebaseexception: An Internal Error Has Occurred. [ User_not_found ]"