ASAuthorizationAppleIDProvider
A mechanism for generating requests to authenticate users based on their Apple ID.
Declaration
class ASAuthorizationAppleIDProviderOverview
You use a provider to create a request (ASAuthorizationAppleIDRequest), which you then use to initialize a controller (ASAuthorizationController) that performs the request:
let provider = ASAuthorizationAppleIDProvider()
let request = provider.createRequest()
let controller = ASAuthorizationController(authorizationRequests: [request])On success, the controller’s delegate receives an authorization (ASAuthorization) containing a credential (ASAuthorizationAppleIDCredential) that has an opaque user identifier. You can use that identifier to later check the user’s credential state—for example, to see if authorization has been revoked—by calling the getCredentialState(forUserID:completion:) method:
let user = authorization.credential.user
provider.getCredentialState(forUserID: user) { state, error in
// Check for error and examine the state.
}