Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda