Skip to content Skip to sidebar Skip to footer

Firebase Auth Check If New User On Facebook Login

I am creating a web app using Firebase auth to authenticate my users and a MongoDB database to store some relevant user information specific to my site. I am trying to add Facebook

Solution 1:

You can detect if a user is new or existing as follows:

firebase.auth().signInWithPopup(provider)
  .then(function(result) {
    console.log(result.additionalUserInfo.isNewUser);
  })
  .catch(function(error) {
    // Handle error.
  });

For more on this refer to the documentation.

Post a Comment for "Firebase Auth Check If New User On Facebook Login"