-1

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.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

1

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. 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.

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.

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807