Firebase get Authentication details using UID

扶醉桌前 提交于 2021-01-28 10:41:09

问题


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)


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/51943394/firebase-get-authentication-details-using-uid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!