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

280
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
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