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

320
Views
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
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!