Ir al contenido principal

Firebase Auth error login

I'm studying a Android-Java developer course, and we are designing an application that uses Email and Password login.

So when we enter the correct email and password a Toast will show up saying "Successful sign in!", the opposite will be "Failed to sign in!".

The problem was that I was always getting a "Failed to sign in!" and I knew my email and password were correct. I didn't get any error in the Logcat, only some weird line from getGoogleApiForMethod.



So I just came up with this marvelous idea: "Just add an exception log to your f*** code!"
And so I did. I added a

Log.e(TAG, "Failed because of: " + task.getException().getMessage());

after my

!task.isSuccessful()

And then I discovered the following:

An internal error has occurred. [ Identity Toolkit API has not been used in project BLAHBLAH before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/identitytoolkit.googleapis.com/overview?project=BLAHBLAH then retry.

Finally, I went to that page and I just needed to click the "ACTIVATE" button.
PS: you have to add the following line inside your MainActivity:


private static final String TAG = "MainActivity";

Solved!


Comentarios