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

283
Views
firebase - check if an user is already registered in database

I have a firebase app that is running on mobile devices and now I need to create the web version of it.

At the moment I have integrated firebase ui to give to users the ability to login. Since I need to show a wizard if the user isn't already registered, how I can check if user exists in the database so I can decide if show the wizard or not and then add it to the database?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I consider you are using firebase auth and firestore, but this is the logic

firebase.auth().onAuthStateChanged(async (user)=> {
            if (user == null){
              //the user is not signed in, navigate to login screen
            }else{
            //the user is signed in, try to check if he exists in the database or register him
            //let say you are using firestore roo
              let user_ = await firebase.app().auth().currentUser
              firebase.firestore().collection("collections_of_users").doc(user_.uid).get().then(snap =>{
              if(snap.exists){
              //the user exists
              }else{
                //register him, and before make sure his email is verified by checking if emailVerified === true
                firebase.firestore().collection("collections_of_users").doc(user_.uid).set({user_mail: user_.email, user_name: "xxx"})
              }
              })
    
    
    }
    
    
       });
about 4 years ago · Juan Pablo Isaza Report

0

It sounds like you're looking for the fetchSignInMethodsForEmail method, which returns the list of providers with which a specified email address has previously been signed in to Firebase.

The typical flow is:

  • Get the email address of the user
  • Call fetchSignInMethodsForEmail to get a list of providers
  • If the list is empty, go to your account creation flow
  • If the list has a single value, show the sign in screen for that provider
  • If the list has multiple values, show a screen where the user can pick from those providers
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!