尝试使用自定义令牌登录Firebase帐户时,会显示此错误。 错误的原因是什么?
07-25 15:04:16.523 2357 811 E Volley : [448] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyCustomToken?key={TOKEN_CODE}
07-25 15:04:16.524 2357 2530 I AuthChimeraService: Error description received from server: {
07-25 15:04:16.524 2357 2530 I AuthChimeraService: "error": {
07-25 15:04:16.524 2357 2530 I AuthChimeraService: "errors": [
07-25 15:04:16.524 2357 2530 I AuthChimeraService: {
07-25 15:04:16.524 2357 2530 I AuthChimeraService: "domain": "global",
07-25 15:04:16.524 2357 2530 I AuthChimeraService: "reason": "invalid",
07-25 15:04:16.524 2357 2530 I AuthChimeraService: "message": "CONFIGURATION_NOT_FOUND"
07-25 15:04:16.524 2357 2530 I AuthChimeraService: }
07-25 15:04:16.524 2357 2530 I AuthChimeraService: ],
07-25 15:04:16.524 2357 2530 I AuthChimeraService: "code": 400,
07-25 15:04:16.524 2357 2530 I AuthChimeraService: "message": "CONFIGURATION_NOT_FOUND"
07-25 15:04:16.524 2357 2530 I AuthChimeraService: }
07-25 15:04:16.524 2357 2530 I AuthChimeraService: }
07-25 15:04:16.524 2357 2530 D AuthIntentChimeraService: Finished operation: << dms (350ms elapsed)
我当前的代码
mAuth = FirebaseAuth.getInstance();
mAuth.signInWithCustomToken(mCustomToken)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d("d", "signInWithCustomToken:onComplete:" + task.isSuccessful());
if (!task.isSuccessful()) {
Log.w("d", "signInWithCustomToken", task.getException());
Toast.makeText(MainActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
答案 0 :(得分:2)
修正了将其添加到gradle
compile 'com.google.firebase:firebase-core:9.2.1'
@Edit 最新版本:
implementation 'com.google.firebase:firebase-core:16.0.1'