Last active
April 29, 2017 19:50
-
-
Save lucianboboc/7399465e1357220234f77e9b3b8bebbc to your computer and use it in GitHub Desktop.
login with facebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 protected], | |
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