0

It possible to get the user id without logging in using firebase authentication API "email/password method"?

Let suppose a function take email as param and return firebase userId

getId(email){
 //this is an example 
 return this.firebase.auth.getId(email); // this method is not firebase method i wrote just for explication
}

enter image description here I need the User UID in the picture above without logging in. (without current user).

Thanks.

Khaled Ramadan
  • 812
  • 1
  • 10
  • 26

1 Answers1

0

You can use the Firebase Admin SDK. From the official documentation

admin.auth().getUserByEmail(email)
  .then(function(userRecord) {
    // See the tables above for the contents of userRecord
    console.log("Successfully fetched user data:", userRecord.toJSON());
  })
  .catch(function(error) {
    console.log("Error fetching user data:", error);
  });

See also: Firebase Authentication Service - lookup uid from email without login

Isurendrasingh
  • 432
  • 7
  • 20
  • how to import firebase admin SDK in angular2 project ? – Khaled Ramadan Apr 29 '18 at 13:42
  • It possible to import Firebase admin SDK from the client side – Khaled Ramadan Apr 29 '18 at 13:57
  • Admin SDK should never be used client side. You can however create an http endpoint that returns that kind of information to the client using admin SDK. You have to be careful though as that also exposes the ability to look up users to external attackers. – bojeil May 01 '18 at 22:36