Reputation: 15
I'm trying to login with Firebase authentication but I'm getting a FirebaseException. In my activity I have the onCreate method:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(R.string.title_calendar);
initData();
}
The onStart method:
@Override
protected void onStart() {
super.onStart();
FirebaseUser user = mAuth.getCurrentUser();
if (user != null) {
// something
} else {
signIn();
}
}
and the signIn method:
private void signIn() {
mAuth.signInWithEmailAndPassword("[email protected]", "123456789").addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
@Override
public void onSuccess(AuthResult authResult) {
Log.i("Log", "signIn:SUCCESS");
}
})
.addOnFailureListener(this, new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Log.e("Log", "signIn:FAILURE", exception);
}
});
}
I'm getting this:
E/shinseiLog: signIn:FAILURE
com.google.firebase.FirebaseException: An internal error has occurred. [ Identity Toolkit API has not been used in project 611854850952 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/identitytoolkit.googleapis.com/overview?project=611854850952 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. ]
at com.google.android.gms.internal.jz.zzK(Unknown Source:147)
at com.google.android.gms.internal.jb.zza(Unknown Source:12)
at com.google.android.gms.internal.kj.zzL(Unknown Source:11)
at com.google.android.gms.internal.kl.onFailure(Unknown Source:35)
at com.google.android.gms.internal.kb.onTransact(Unknown Source:79)
at android.os.Binder.execTransact(Binder.java:697)
the authentication method email, password is enabled on firebase console and also Identity Toolkit API.
Upvotes: 1
Views: 212
Reputation: 737
Is your google-services.json file from Firebase up to date? As you enable services in Firebase that JSON gets updates. Try re-downloading it from Firebase and check if it is different?
Upvotes: 0
Reputation: 504
Please Check Your Project Existing firebase console using following URL https://console.firebase.google.com If is it available rebuild your project using Build -> Rebuild Project and Resync your project using Gradle Files
Upvotes: 2