I am building a admin panel for a android app in javascript and php in which i created a users table with Firebase Authentication UID so every user key is UID but in this user table i am not inserting Auth Identifier. now in my admin panel how can i retrieve Auth Identifier (Phone Number) using UID(user Key)
2 Answers
An alternative to storing the data in the database (as Qasim answered) is to use the Firebase Admin SDK to look up the user's profile by its UID.
The Firebase Admin SDK runs with administrative privileges, and thus can perform certain sensitive operations that the regular client-side SDKs are not allowed to do. As such, it is meant to be only run in trusted environments, such as your development machine, a server that you control, or Cloud Functions for Firebase. With these last two you could create your own API, that your admin panel then calls. Just be sure to secure the API, because otherwise you're leaking user information.

- 565,676
- 79
- 828
- 807
You can only get the firebase authenticated User info from the current session/user, and if you need to query for it later then you need to save it in your own datastore.
For more details, see this https://www.firebase.com/docs/web/guide/user-auth.html#section-storing

- 5,181
- 4
- 30
- 51
-
ok so there is otherway to get authenticated User info using UID . that means i need to store phone number in app..but there are already users created in my app database what about them do i need to manually insert phone number in database ? – sam999 Aug 21 '18 at 07:24
-
you can write a migration script or something like that for existing datastore – Qasim Aug 21 '18 at 07:28
-
migration script like what ? any clues or hint – sam999 Aug 21 '18 at 07:33
-
here's a nice article worth reading to get hint https://medium.com/@wcandillon/firebase-schema-evolution-ea830a62c14e – Qasim Aug 21 '18 at 07:36