I have implemented Apple SignIn in one of my application. But when user selects hide my email, then i am getting Email and FullName as nil values. Can anyone please help me on this?
I have implemented Apple SignIn in one of my application. But when user selects hide my email, then i am getting Email and FullName as nil values. Can anyone please help me on this?
Did you aware of defining request scopes while you were performing request?
Your code should be some how similar to this:
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email]
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.performRequests()
And when you receive the response, after converting it to ASAuthorizationAppleIDCredential, You can see fullname and email address by printing them out :
func authorizationController(controller: ASAuthorizationController,
didCompleteWithAuthorization authorization: ASAuthorization) {
switch authorization.credential {
case let appleIDCredential as ASAuthorizationAppleIDCredential:
debugPrint(appleIDCredential.email) //prints either 'email' or 'proxied email'
debugPrint(appleIDCredential.fullName) //prints name 'object'
default:
break
}
}
Edit:
If problem persists, go to settings -> profile -> password and security -> apps using your apple id
find your app and revoke its access and try again!
nil. No way to get the email.fullName. But in second-time authentication, the value of fullName will be nil.For more you can check this: ASAuthorizationAppleIDRequest with name and mail scope returns nil values