Class

ASAuthorizationAppleIDProvider

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

Declaration

class 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 getCredentialState(forUserID: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

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.

Relationships

Inherits From

See Also

Sign In with Apple

Adding the Sign In with Apple Flow to Your App

Provide a fast, secure, and privacy-friendly way for users 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
class ASAuthorizationController

A controller that manages authorization requests created by a provider.

class ASAuthorizationAppleIDCredential

A credential that results from a successful Apple ID authentication.