Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
Firestore Get data

I wanna fetch the data from firestore and show the data inside web page when user enter the email. Like press submit, then user data of the entered email will show. But the code below is not working. Can someone help me.

function shareAccess(){
    
  var email = document.getElementById('email').value;
  auth.signInWithEmailAndPassword(email, password)
    .then(function() {

      var user_data = {
        email : email,
      }

      db.collection("users").get(user_data).then((querySnapshot) => {
      querySnapshot.forEach((doc) => {
        alert(`${doc.id} => ${doc.data()}`);
    });
});
  })
  
}
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

function shareAccess(){
    
  var email = document.getElementById('email').value;
  auth.signInWithEmailAndPassword(email, password)
    .then(function() {

      var user_data = {
        email : email,
      }

      db.collection("users").get(email).then((querySnapshot) => {
      querySnapshot.forEach((doc) => {
        alert(`${doc.id} => ${doc.data()}`);
    });
});
  })
  
}
about 4 years ago · Juan Pablo Isaza Report

0

As mentioned in the Documentation :

The Firebase Admin SDK supports looking up user information with an email:

getAuth()
  .getUserByEmail(email)
  .then((userRecord) => {
    // See the UserRecord reference doc for the contents of userRecord.
    console.log(`Successfully fetched user data: ${userRecord.toJSON()}`);
  })
  .catch((error) => {
    console.log('Error fetching user data:', error);
  });

For more information, you can refer to the Answer where a similar issue has been explained and documentation explained about two ways to retrieve data stored in Cloud Firestore.

  • Call a method to get the data.
  • Set a listener to receive data-change events.
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!