Skip to content

Instantly share code, notes, and snippets.

@lucianboboc
Last active April 29, 2017 19:50
Show Gist options
  • Save lucianboboc/7399465e1357220234f77e9b3b8bebbc to your computer and use it in GitHub Desktop.
Save lucianboboc/7399465e1357220234f77e9b3b8bebbc to your computer and use it in GitHub Desktop.
login with facebook
func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
if let error = error {
print(error.localizedDescription)
return
}
if !result.isCancelled {
let credential = FIRFacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
FIRAuth.auth()?.signIn(with: credential) { (user, error) in
if let error = error {
print(error.localizedDescription)
/*
[AnyHashable("error_name"): ERROR_EMAIL_ALREADY_IN_USE,
AnyHashable("FIRAuthErrorUserInfoEmailKey"): email@example.com,
AnyHashable("NSLocalizedDescription"): The email address is already in use by another account.]
*/
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment