Firebase get user by ID [duplicate]

孤人 提交于 2020-05-13 01:04:09

问题


Is there a way to get user information (like email, picture) based on its UID?

I mean not for the currently logged user, but any other user.


回答1:


If you're using the authentication methods provided by Firebase, then no, you can only get it from the current session/user, and if you need to query for it later then you need to save it in your own datastore.

Usually what I do is load the user data when authentication changes, if it's not there then I save a new object (using the uid as key), with whatever data is relevant for the application. If you're interested in the picture then you might need to update your data often.

You can find a more in depth explanation, with some actual samples, in the following question: Where does firebase save it's simple login users?.



来源:https://stackoverflow.com/questions/39542945/firebase-get-user-by-id

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