如何使用手机号码iOS获取Firebase联系人 [英] How to get firebase contacts with mobile number ios

查看:73
本文介绍了如何使用手机号码iOS获取Firebase联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Firebase聊天应用程序.我已经使用手机号码登录了,现在我想获取已在Firebase中注册的联系人以及我的设备联系人.想获取Firebase联系人. 谢谢.

I am working on chatting app using firebase. I had signed in with mobile number and now i want to get contacts both who are registered with firebase and my device contacts.Want to get firebase contacts. Thank you.

推荐答案

无法从iOS SDK中获取所有Firebase身份验证用户的列表,因为那样会导致各种滥用.

There is no way to get a list of all Firebase Authentication users from the iOS SDK, as that would allow all kinds of abuse.

不过,有两种实现用例的常用方法:

There are two common approaches to implementing your use-case though:

  1. 将每个用户所需的信息存储在Firebase的实时数据库或Cloud Firestore等云数据库中.您需要在注册每个用户时执行此操作,然后您的应用程序才能从那里读取它.
  2. 使用Admin SDK进行Firebase身份验证,确实可以列出用户.此SDK仅可在受信任的环境中使用,例如开发机器,您控制的服务器或Cloud Functions.您将使用Admin SDK创建一个自定义API,您的应用程序可以调用它,然后返回用例所需的信息.
  1. Store the information you need for each user in a cloud database, such as Firebase's Realtime Database or Cloud Firestore. You'd do this on registering each user, and then your app can read it from there.
  2. Use the Admin SDK for Firebase Authentication, which does have a way to list users. This SDK can only be used in trusted environments, such as your development machine, a server you control, or Cloud Functions. You'd use the Admin SDK to create a custom API that your application can call, and that then return the information needed for your use-case.

这两种方法都使您可以完全控制要公开的数据,因此,不必担心客户端API会固有的风险.不过,请务必仅允许使用针对您的应用程序授权的方式访问数据,否则很容易泄漏用户数据.

Both of these give you full control of what data is exposed, so don't have the inherent risk that a client-side API would have. Be sure to only allow access to the data in a way that is authorized for your application though, as it's quite easy to leak user data otherwise.

另请参阅:

  • How to programmatically get the list of registered users in Firebase
  • How do I return a list of users if I use the Firebase simple username & password authentication
  • Retrieving a list of users who have registered using Firebase Auth
  • and probably more from these search results

这篇关于如何使用手机号码iOS获取Firebase联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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