Firebase Facebook login check if user exist

后端 未结 1 931
迷失自我
迷失自我 2021-01-03 08:53

I have an facebook login system which works with firebase but I want to check if user exist on my firebase (i don\'t want to add it, just want to make sure if he exist becau

相关标签:
1条回答
  • 2021-01-03 09:28

    You can use reauthenticateWithCredential method to check user is exist or not.

    Check this Doc. , section -> Re-authenticate a user

    let user = FIRAuth.auth()?.currentUser
    var credential: FIRAuthCredential
    
    // Prompt the user to re-provide their sign-in credentials
    
    user?.reauthenticateWithCredential(credential) { error in
      if let error = error {
        // An error happened.
      } else {
        // User re-authenticated.
      }
    }
    

    If user re-authenticated successfully that means user is existed...

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