Firebase Auth check if new user on Facebook login

后端 未结 1 923
有刺的猬
有刺的猬 2020-12-11 19:47

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 F

相关标签:
1条回答
  • 2020-12-11 20:16

    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.

    0 讨论(0)
提交回复
热议问题