Can't get full name from ASAuthorizationAppleIDCredential

Hi, there.

I'm developing an app and using "Sign in with Apple".

The issue that I encountered is the ASAuthorizationAppleIDCredential doesn't provide fullName.

It returns nil.

I've checked all and it's the first sign up.

I used a real device and simulator and 2 apple ids.

I've debugged and got a strange result.

https://www.dropbox.com/s/3egc3se78gxzszl/Screenshot%202020-05-28%20at%2001.14.42.png?dl=0

Please let me know what mistake I made.

Thanks.

Replies

When you make the request to ASAuthorizationAppleIDProvider, you need to setup the requestedScopes including fullName.

Code Block
 let appleIDProvider = ASAuthorizationAppleIDProvider()
     let request = appleIDProvider.createRequest()
     request.requestedScopes = [.fullName]


Hi,

Please see the iOS sample code called Implementing User Authentication with Sign in with Apple. Specifically, the section titled, "Request Authorization with Apple ID", which states the following—

When the user taps the Sign in with Apple button, the view controller invokes the handleAuthorizationAppleIDButtonPress()  function, which starts the authentication flow by performing an authorization request for the users’s full name and email address. The system then checks whether the user is signed in with their Apple ID on the device. If the user is not signed in at the system-level, the app presents an alert directing the user to sign in with their Apple ID in Settings.

Code Block swift
@objc
func handleAuthorizationAppleIDButtonPress() {
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email]
let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.presentationContextProvider = self
authorizationController.performRequests()
}


Note: The user's full name will only be provided to the initial authorization success response; the verified email address and nonce will be included in the identity token for subsequent authorization requests. For additional information about the expected behavior of the user's information with Sign in with Apple, see here.
Hi ppinkney,

You state that "the verified email address and nonce will be included in the identity token for subsequent authorization requests". Does this mean that if the user chose to hide their email address, it won't show up in the identity token?