如果我使用电话号码登录用户而不在Firebase中创建用户,该怎么办? [英] What will happen if I sign in user using phone number without user creation in firebase?

查看:45
本文介绍了如果我使用电话号码登录用户而不在Firebase中创建用户,该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在尝试使用Firebase创建登录和注册流程,主要要求是使用电话号码.

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

但是我发现我只能使用 createUserWithEmailAndPassword 来欺骗用户.现在的问题是如何使用电话号码注册用户.

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.

如果不是,那么Firebase如何使用电话号码登录用户?

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

推荐答案

当您

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.

文档中的相关代码:


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();
                // ...

这篇关于如果我使用电话号码登录用户而不在Firebase中创建用户,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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