I'm trying to implement Sign in with Apple since it's required now when you have other third party login library. My question is, is there a way for me to get apple's auth token just like from facebook and google login? All I could get is identity token and authorization code from ASAuthorizationAppleIDCredential. I am not quite sure what is used to get user information using our API.
Thank you so much for the answer.
in ASAuthorizationControllerDelegate
get the token
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) {
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential {
if let data = appleIDCredential.identityToken {
let token = String(decoding: data, as: UTF8.self)
// here send token to server
}
}
}
}
send the token to the server, which must be set up https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api
and based on this token your server will get the user information from Apple the same way you can get the facebook user data.
Then your api should implement user authentication based on this data (e.g. create user account based on the user email and return your access token to the app)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With