您好我几个月来一直在使用firebase,但这个问题从未在我的其他项目中出现过。当我想使用常规signInWithEmailAndPassword()方法登录时,我用电子邮件/密码编写了相同的身份验证代码,它给了我这个错误:
com.google.firebase.FirebaseException: An internal error has occurred. [ Access Not Configured.
Google Identity Toolkit API has not been used in project <Project-id> before or it is disabled. Enable it by visiting https ]
at com.google.android.gms.internal.zzbix.zzcb(Unknown Source)
at com.google.android.gms.internal.zzbiu$zzj.zza(Unknown Source)
at com.google.android.gms.internal.zzbjf.zzcc(Unknown Source)
at com.google.android.gms.internal.zzbjf$zza.onFailure(Unknown Source)
at com.google.android.gms.internal.zzbja$zza.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:453)
我在firebase控制台中启用了电子邮件/密码登录方法我还重新生成sha-1符号并覆盖现有的google-service.json但是没有一个能解决我的问题。
编辑代码示例:
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(LoginActivtity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithEmail:failed", task.getException());
}
}
});