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


class ASAuthorizationAppleIDProvider : NSObject


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.


Offering Sign In with Apple

class ASAuthorizationAppleIDButton

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

class WKInterfaceAuthorizationAppleIDButton

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

Creating Requests

func createRequest() -> ASAuthorizationAppleIDRequest

Creates a new Apple ID authorization request.

class ASAuthorizationAppleIDRequest

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

class ASAuthorizationOpenIDRequest

An OpenID authorization request.

Getting State

enum ASAuthorizationAppleIDProvider.CredentialState

Possible values for the credential state of a user.


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.

class ASAuthorizationController

A controller that manages authorization requests created by a provider.

class ASAuthorizationAppleIDCredential

A credential that results from a successful Apple ID authentication.