What will happen if I sign in user using phone number without user creation in firebase?

时光毁灭记忆、已成空白 提交于 2021-01-29 21:21:07

问题


So, I am trying to create a sign-in and sign-up flow using firebase with primary requirement using phone number.

But I found that I am only able to sing up the user using createUserWithEmailAndPassword only. Now the issue is how do I sign up the user using phone number.

If not then how does firebase sign in user using phone number?


回答1:


A Firebase Authentication user account is created when signing up/in with phone number when you call the signInWithCredential method. At that point you can get the FirebaseUser object, and the UID from that.

The relevant code from the documentation:


mAuth.signInWithCredential(credential)
     .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(TAG, "signInWithCredential:success");

                FirebaseUser user = task.getResult().getUser();
                // ...



来源:https://stackoverflow.com/questions/59590056/what-will-happen-if-i-sign-in-user-using-phone-number-without-user-creation-in-f

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