小编Ali*_*min的帖子

无法在没有 verifyProof、sessionInfo、临时证明或注册 ID 的情况下创建 PhoneAuthCredential

我正在处理firebase电话身份验证,在我的电话号码上收到代码后,代码跳转到verifysignincode()方法,但无法创建phoneAuthCredentials. 程序捕获的例外是“不能在没有、、临时证明或注册 ID 的PhoneAuthCredential情况下创建”。verificationProofsessionInfo

这是我的发送代码方法:

    public void send_code(){
    mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
        @Override
        public void onCodeSent(@NonNull String s, @NonNull PhoneAuthProvider.ForceResendingToken forceResendingToken) {
            super.onCodeSent(s, forceResendingToken);
            Log.d("code", "onCodeSent:" + s);
            verificationID=s;
        }
        @Override
        public void onVerificationCompleted(@NonNull PhoneAuthCredential phoneAuthCredential) {

        }
        @Override
        public void onVerificationFailed(@NonNull FirebaseException e) {
            Toast.makeText(PhoneAuthentication.this, e.getMessage(), Toast.LENGTH_SHORT);
        }
    };
    mPhoneAuthProvider.verifyPhoneNumber(
            user_contact , 60, TimeUnit.SECONDS, PhoneAuthentication.this, mCallbacks
    );}
Run Code Online (Sandbox Code Playgroud)

这是我的验证登录方法:

    public void verifySignInCode(String code){
    try {
        PhoneAuthCredential credential = PhoneAuthProvider.getCredential(verificationID, …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-authentication

5
推荐指数
1
解决办法
5125
查看次数