How to get the email of any user in Firebase based on user id?

前端 未结 5 1678
灰色年华
灰色年华 2020-12-09 04:48

I need to get a user object, specifically the user email, I will have the user id in this format:

simplelogin:6

So I need to write a function so

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 05:17

    Current solution as per latest update of Firebase framework:

    firebase.auth().currentUser && firebase.auth().currentUser.email
    

    See: https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#currentuser

    Every provider haven't a defined email address, but if user authenticate with email. then it will be a possible way to achieve above solution.

提交回复
热议问题