Class

ASWebAuthenticationSession

A session that an app uses to authenticate a user through a web service.

Declaration

@interface ASWebAuthenticationSession : NSObject

Overview

Use an ASWebAuthenticationSession instance to authenticate a user through a web service, including one run by a third party. Initialize the session with a URL that points to the authentication webpage. A browser loads and displays the page, from which the user can authenticate. In iOS, the browser is a secure, embedded web view. In macOS, the system opens the user’s default browser if it supports web authentication sessions, or Safari otherwise.

On completion, the service sends a callback URL to the session with an authentication token, and the session passes this URL back to the app through a completion handler.

For more details, see Authenticating a User Through a Web Service.

Topics

Creating a Session

- initWithURL:callbackURLScheme:completionHandler:

Creates a web authentication session instance.

ASWebAuthenticationSessionCompletionHandler

A completion handler for the web authentication session.

Configuring a Session

prefersEphemeralWebBrowserSession

A Boolean value that indicates whether the session should ask the browser for a private authentication session.

Starting and Stopping a Session

- start

Starts a web authentication session.

- cancel

Cancels a web authentication session.

Presenting a Session

presentationContextProvider

A delegate that provides a display context in which the system can present an authentication session to the user.

ASWebAuthenticationPresentationContextProviding

An interface the session uses to ask a delegate for a presentation context.

Recognizing Errors

ASWebAuthenticationSessionErrorDomain

The error domain for a web authentication session.

ASWebAuthenticationSessionErrorCode

The error code for a web authentication session error.

Relationships

Inherits From

See Also

Web-Based Login

Authenticating a User Through a Web Service

Use a web authentication session to authenticate a user in your app.