Firebase自定义令牌身份验证发生内部错误

时间:2018-04-10 14:44:00

标签: android firebase firebase-authentication

我使用Firebase自定义令牌来验证用户身份。当我使用Android Naugate运行应用程序时,它工作正常,但当我尝试使用Android版本5.1.1的另一部手机进行身份验证时,它会给我这样的错误

com.google.firebase.FirebaseException: An internal error has occurred. [ null ]
    at com.google.android.gms.internal.zzdxm.zzao(Unknown Source)
    at com.google.android.gms.internal.zzdwn.zza(Unknown Source)
    at com.google.android.gms.internal.zzdxx.zzap(Unknown Source)
    at com.google.android.gms.internal.zzdya.onFailure(Unknown Source)
    at com.google.android.gms.internal.zzdxo.onTransact(Unknown Source)
    at android.os.Binder.execTransact(Binder.java:453)

有时会给我这样的错误

com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host) has occurred.

代码调用Firebase如下:

firebaseAuth.signInWithCustomToken(customToken)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                        // Sign in success, update UI with the signed-in user's information
                        Log.d("SignIn", "signInWithCustomToken:success");
                        FirebaseUser user = firebaseAuth.getCurrentUser();
                        userId=user.getUid();
                        Log.e("current User is",user.getUid());

                    } else {
                        // If sign in fails, display a message to the user.
                        Log.e("Firebase Error",""+task.toString());
                        Log.e("Sign iN failed", "signInWithCustomToken:failure", task.getException());
                        Toast.makeText(ChatActivity.this, "Authentication failed.",
                                Toast.LENGTH_SHORT).show();
                        /// updateUI(null);
                    }
                }
            });

请帮我解决此错误。谢谢

0 个答案:

没有答案