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.
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?.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With