Hashir Sarwar
Hashir Sarwar

Reputation: 1265

How can I find a phone number from authenticated users in Firebase?

I am making an android chat application and I am trying to fetch those contacts who have created their account. If any contact of a user has not created the account, that contact should not be in the list. I cannot find a proper way to query my authenticated users and comparing them with the user's contact. How can I achieve this?

Upvotes: 1

Views: 811

Answers (2)

swapnilmdkapse
swapnilmdkapse

Reputation: 51

Best way is to create user collection in Firestore database after authentication and store all user information like name, email, mobile, status etc. in that collection. And afterward you can query likewise.

Upvotes: 1

Doug Stevenson
Doug Stevenson

Reputation: 317712

Firebase Authentication doesn't provide any methods for clients to query the list of users who have authenticated. The Firebase Admin SDK (usable only in server code) can only list all users or fetch a particular user by UID.

If the Admin SDK isn't sufficient, it's your responsibility to store the information you'd like to query in a database that satisfies your needs. Many developers choose to use Realtime Database or Cloud Firestore for this, but you can use whatever you want.

Upvotes: 1

Related Questions