com.google.firebase.FirebaseException:发生了内部错误。 [ 空值 ]

时间:2018-04-11 02:53:13

标签: android firebase firebase-authentication

帮助我们想使用firebase使用自定义firebase令牌验证我的应用程序,但是当令牌创建并发送到我的应用程序时,firebase无法验证我的令牌并抛出

  

com.google.firebase.FirebaseException:发生内部错误。 [null]

网络服务代码

            FirebaseAuth.getInstance(instancePatient).createCustomToken(uid2, additionalClaims)
                    .addOnSuccessListener(new OnSuccessListener<String>() {
                        @Override
                        public void onSuccess(String customToken) {
                            str.setResponse(customToken);
                            System.out.println(customToken);
                        }
                    });

我的应用代码

    FirebaseAuth mAuth = FirebaseAuth.getInstance();
    mAuth.signInWithCustomToken(userString)
            .addOnCompleteListener(activity, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (!task.isSuccessful()) {
                        try{
                            throw task.getException();
                        }
                        catch (IllegalStateException e){
                            System.out.println(e.getMessage());
                        }
                        catch(RuntimeExecutionException e){
                            System.out.println(e.getMessage());
                        }
                        catch(FirebaseNetworkException e ){
                            System.out.println(e);
                        }
                        catch(FirebaseAuthException e){
                            System.out.println(e);
                        }
                        catch(Exception e){
                            System.out.println(e.getMessage());
                        }
                        listener.onSignInWithCustomTokenFailed(task);
                    }
                    else
                    {......
                    }
                }
            }

我希望你们都懂我的英语。

1 个答案:

答案 0 :(得分:0)

好吧,结果是从createCustomToken中删除additionalClaims解决了这个问题。这是因为我输入了一个非变量字符串给additionalClaims