Class

ASAuthorizationAppleIDProvider

A mechanism for generating requests to authenticate users based on their Apple ID.

Declaration

@interface ASAuthorizationAppleIDProvider : NSObject

Overview

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 getCredentialStateForUserID:completion: method:

let user = authorization.credential.user
provider.getCredentialState(forUserID: user) { state, error in
    // Check for error and examine the state.
}

Topics

Offering Sign In with Apple

ASAuthorizationAppleIDButton

A control you add to your interface that enables users to initiate the Sign In with Apple flow.

WKInterfaceAuthorizationAppleIDButton

A button that you can use to trigger a Sign in with Apple request.

Creating Requests

- createRequest

Creates a new Apple ID authorization request.

ASAuthorizationAppleIDRequest

An OpenID authorization request that relies on the user’s Apple ID.

ASAuthorizationOpenIDRequest

An OpenID authorization request.

Getting State

- getCredentialStateForUserID:completion:

Returns the credential state for the given user in a completion handler.

ASAuthorizationAppleIDProviderCredentialState

Possible values for the credential state of a user.

Relationships

Inherits From

See Also

Sign In with Apple

Implementing User Authentication with Sign in with Apple

Provide a way for users of your app to set up an account and start using your services.

Sign in with Apple Entitlement

An entitlement that lets your app use Sign in with Apple.

Key: com.apple.developer.applesignin
ASAuthorizationController

A controller that manages authorization requests created by a provider.

ASAuthorizationAppleIDCredential

A credential that results from a successful Apple ID authentication.