MISSING_CLIENT_IDENTIFIER,while trying to do PhoneAuth in Android

倖福魔咒の 提交于 2019-12-13 17:21:45

问题


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

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

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

Here's my code

 @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;




    }
}

回答1:


I also faced the same problem, it was because i tried and tested to many times using same device with my wifi network as well as mobile network. So somehow they blocked the request for this client id. As soon as i tried it in different device with different network everything was fine. While developing just whitelisting a number and provide verification code for it



来源:https://stackoverflow.com/questions/45917917/missing-client-identifier-while-trying-to-do-phoneauth-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!