Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda