1

I implement email/password sign-in method provided by Firebase in my Android apps. It was working fine. But today it didn't work for some reasons unknown to me. I didn't change any codes related to my login activity and didn't change the settings in my Firebase console.

enter image description here

private void signIn(String email, String password) {
    Log.d(TAG, "signIn:" + email);
    if (!validateForm()) {
        return;
    }

    showProgressDialog();

    // [START sign_in_with_email]
    firebaseAuth.signInWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, task -> {
                if (task.isSuccessful()) {
                    // Sign in success, update UI with the signed-in user's information
                    Log.d(TAG, "signInWithEmail:success");
                    FirebaseUser user = firebaseAuth.getCurrentUser();
                    updateUI(user);
                } else {
                    // If sign in fails, display a message to the user.
                    Log.w(TAG, "signInWithEmail:failure", task.getException());
                    Toast.makeText(LoginActivity.this, "Authentication failed.",
                            Toast.LENGTH_SHORT).show();
                }

                hideProgressDialog();
            });
    // [END sign_in_with_email]
}

In the Logcat, it showed that the program did reach the sign in method, but somehow the authentication process never completed (the log never shows signInWithEmail:success or signInWithEmail:failure).

enter image description here

I did try other solution such as changing addOnCompleteListener to addOnSuccessListener but nothing changed. Is Firebase service currently not working? Or is there something wrong with my codes? I'm completely at lost. I appreciate any thoughts you'd like to share.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
idiotme
  • 63
  • 7
  • "Is Firebase service currently not working?" To find that our, check https://status.firebase.google.com/. But there are currently no known outages. – Frank van Puffelen Dec 24 '18 at 16:42
  • @FrankvanPuffelen Thanks. The service is working fine then. I guess I should try to reinstall my Android SDK now – idiotme Dec 24 '18 at 17:06

4 Answers4

1

I managed to make it work again by creating a new emulator with x86_64 SDK. I think it's related with this question and this question

idiotme
  • 63
  • 7
0

Did you logout ? Try to logout first and then it will sign in.

Try doing firebaseAuth.signOut() in your onCreate method. It might help.

shellym
  • 546
  • 1
  • 5
  • 11
  • Thanks for the suggestion, but I think that's not it. I didn't even manage to sign in before because the process never completed. Turns out it had to do with the google services. – idiotme Dec 24 '18 at 17:50
0

but this log refers to the method (SignIn) not the firebaseAuth method, check your connection to firebase from Tools->Firebase -> Authentication -> Connect to Firebase (if not connected)

  • The firebaseAuth method is in the signIn method as you can see in the snippet I provided. I thought showing that the email/password method was enabled already implied that my app was indeed connected to Firebase. I already answer the question though, thanks for your thought – idiotme Dec 24 '18 at 22:14
  • bro imean that when the method is called the log is called , but if the task.isSuccessful it should give Log.d(TAG, "signInWithEmail:success"); as you did – Omar Gaber Dec 24 '18 at 22:33
0

I had another task FirebaseAuth.getInstance().currentUser.getIdToken(true). It never completed because I called it from the main thread. When I called from the background thread - it completed.

Andrew
  • 2,438
  • 1
  • 22
  • 35