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

325
Visualizações
How to get document after user has logged in using google auth in firebase?

I want to fetch user information stored in firestore after the user has logged in using google sign in. I am checking whether the user exists or not. If the user does not exist then I am creating a new document in firestore.

 const q = query(collection(db, "users"),where("uid", "==", user.uid));

 getDocs(q).then((doc) => {
      if (doc.docs.length === 0) {
        addDoc(collection(db, "users"), {
          uid: user.uid,
          name: user.displayName,
          authProvider: "google",
          email: user.email,
          lists: [],
        }).then((response) => {
          console.log(response);
        });
      }else{
        console.log(doc.docs);
      }

user is the user Object I am getting after google sign in.

The doc.docs is not giving the document data which I need, namely lists. How do fetch that?

about 4 years ago · Juan Pablo Isaza
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