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

143
Views
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 answers
Answer question

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 Report

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 Report

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