MISSING_CLIENT_IDENTIFIER,尝试在Android中进行PhoneAuth时 [英] MISSING_CLIENT_IDENTIFIER,while trying to do PhoneAuth in Android

查看:107
本文介绍了MISSING_CLIENT_IDENTIFIER,尝试在Android中进行PhoneAuth时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用Firebase Auth进行电话身份验证,我已经确保按照所有步骤进行操作,添加我的包裹名称,使用

I've been trying to do a Phone Authentication Method using Firebase Auth, I've made sure that all the steps are followed, adding my package name,adding SHA Key using

keytool -list -v -keystore%USERPROFILE%.android \ debug.keystore" -alias androiddebugkey -storepass android -keypass android

keytool -list -v -keystore "%USERPROFILE%.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

,然后将所有依赖项以及json文件也添加到我的项目中

and then adding all the dependencies and also including the json file into my project

现在,我以 + CountryCodeXXXXX 格式发送我的电话号码,由于某种原因,它以PhoneAuthProvider.OnVerificationStateChangedCallbacks()方法为我提供了 MISSING_CLIENT_IDENTIFIER ,任何输入都是有帮助的

Now I'm sending my Phone number in a +CountryCodeXXXXX format and for some reason, it gives me a MISSING_CLIENT_IDENTIFIER in PhoneAuthProvider.OnVerificationStateChangedCallbacks() method,any inputs would be helpfull

这是我的代码

 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    editText = (EditText) findViewById(R.id.edit);
    send = (Button) findViewById(R.id.btnSend);
    send.setOnClickListener(this);
    mCallbacks= new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
        @Override
        public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) {
            Toast.makeText(getBaseContext(),"Verification Successfull",Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onVerificationFailed(FirebaseException e) {
            Toast.makeText(getBaseContext(),"Verification Failed "+e,Toast.LENGTH_LONG).show();
        }
    };
}




@Override
public void onClick(View view) {
    switch (view.getId()) {

        case R.id.btnSend:
            String temp = editText.getText().toString();
            Toast.makeText(getBaseContext(),temp,Toast.LENGTH_SHORT).show();
            PhoneAuthProvider.getInstance().verifyPhoneNumber(
                    temp,        // Phone number to verify
                    60,                 // Timeout duration
                    TimeUnit.SECONDS,   // Unit of timeout
                    this,               // Activity (for callback binding)
                    mCallbacks);
    break;




    }
}

推荐答案

我已经通过反复试验(令人厌烦的是没有记录)确定,当您禁用验证码请求(或无提示APN请求)firebase用于验证应用程序时,会发生这种情况环境,并且您正在尝试使用非列入白名单的号码登录.

I've determined through trial and error (annoyingly undocumented) that this happens when you have disabled the captcha request (or silent APN request) firebase uses to verify app environment, and you are trying to sign in on a non-white-listed number.

fbAuth.settings.appVerificationDisabledForTesting = YES;

^将其更改回NO,即可再次使用.

^Change this back to NO and it will all work again.

这篇关于MISSING_CLIENT_IDENTIFIER,尝试在Android中进行PhoneAuth时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆