0

I need to get the user ID when I input the mail of the user.

Is it possible?

Of course I have an authenticated user who is asking for the mail of a user already created.

I want to retrieve users like

var refer = firebase.auth ().ref ('test@test.com')
  refer.on ('value', function (snapshot) {
    console.log (snapshot.val());
  })

But in a possible way.

adjuremods
  • 2,938
  • 2
  • 12
  • 17
RaulGM
  • 272
  • 2
  • 6
  • 21
  • `firebase.auth ().ref ('test@test.com')` I don't think that is the `auth` service has a `ref()` method: https://firebase.google.com/docs/reference/js/firebase.auth.Auth. – Frank van Puffelen Oct 17 '16 at 18:26
  • Aside from that: there is no API to look up the uid of a user based on their email address in Firebsae Authentication. If you need that functionality, you'll need to store the mapping yourself ; for example in the Firebase Database. – Frank van Puffelen Oct 17 '16 at 18:30
  • Yep, I finally did exactly that. Thanks for your time. – RaulGM Oct 17 '16 at 19:57

1 Answers1

1

Store the user info you want on a separate node in your database structure, then when the user asks for that, you retrieve from that endpoint.

See these:

Community
  • 1
  • 1
KhoPhi
  • 9,660
  • 17
  • 77
  • 128