如何在电话验证期间检查Firebase中是否已存在用户 [英] How to check if a user already exists in firebase during phone auth

查看:53
本文介绍了如何在电话验证期间检查Firebase中是否已存在用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建仅使用来自Firebase的电话授权的应用.由于登录/注册是通过相同的过程完成的,因此正在验证发送的代码.我如何检查Firebase中是否已存在用户?我需要向他们展示适当的用户界面.

I'm trying to create an app that only uses phone authorization from firebase. Since the login/signup is done through same process, which is verifying the sent code. How can i check if a user already exists in firebase? I need this to show them appropriate User Interface.

推荐答案

现在,唯一的方法是通过Firebase Admin SDK.有一个API可以通过电话号码查找用户.

Right now, the only way to do that is via the Firebase Admin SDK. There is an API to lookup a user by phone number.

admin.auth().getUserByPhoneNumber(phoneNumber)
  .then(function(userRecord) {
    // User found.
  })
  .catch(function(error) {
    console.log("Error fetching user data:", error);
  });

这篇关于如何在电话验证期间检查Firebase中是否已存在用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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