Last active
June 7, 2019 20:39
-
-
Save henning-jh/9b0b4cd0a5484c5fc89afcab0c1c2426 to your computer and use it in GitHub Desktop.
Sign In with Apple: handle login result
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
extension MyLoginViewController: ASAuthorizationControllerDelegate { | |
func authorizationController(controller: ASAuthorizationController, | |
didCompleteWithAuthorization authorization: ASAuthorization) { | |
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential { | |
let userIdentifier = appleIDCredential.user | |
let fullName = appleIDCredential.fullName | |
let email = appleIDCredential.email | |
// Now we have the account information. | |
// We can store the userIdentifier in our account | |
// system as the username. | |
} else if let passwordCredential = authorization.credential as? ASPasswordCredential { | |
// Sign in using an existing iCloud Keychain credential. | |
let username = passwordCredential.user | |
let password = passwordCredential.password | |
// handle being logged in the old way | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment