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.