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

145
Vistas
Firebase - check if user created with Google Account is signing up or logging in?

I'm trying to create a web application, where you can log-in and register an account with a google account. I have managed to make it so they can log-in with the signInWithPopup(provider), but not sure how to Implement the sign-up. Any suggestions? or know of any functions in firebase i can use?

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

There aren't any separate methods to login and sign up when using Google Sign-In or any other provider. If a user with that credential exists then user will be logged in else a new user account will be created. You can then use additionalUserInfo.isNewUser property from the result received from signInWithPopUp method to check if the user is new.

firebase.auth().signInWithPopup(provider).then(function (result) {
  const {additionalUserInfo: {isNewUser}} = result;

  console.log(isNewUser ? "This user just registered" : "Existing User")
})

For the new Modular SDK (V9.0.0+), the same can be written as:

import { signInWithPopup, getAdditionalUserInfo } from "firebase/auth"

const result = await signInWithPopup(auth, googleProvider);

// Pass the UserCredential   
const { isNewUser } = getAdditionalUserInfo(result)    
about 4 years ago · Juan Pablo Isaza Denunciar

0

So far, as I understood, you have two options to log in to your website: one is to make a local username/password account on your website, and the other option is to use your google account. I suppose the best way would be to check if the Google account is linked to any existing user using additionalUserInfo.isNewUser, and then linking up your google account with the account that is created via your website locally by following this article: https://firebase.google.com/docs/auth/web/account-linking?hl=lt

about 4 years ago · Juan Pablo Isaza Denunciar

0

Once you have Firebase dependency inside your application. You can use createUserWithEmailAndPassword method to do that.

firebase
.auth()
.createUserWithEmailAndPassword("email@domain.com", "123123")
.then(data => {
    data.user.updateProfile({
        displayName: this.form.name
    }).then(() => {});
})
.catch(err => {
    this.error = err.message;
});
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