WebAuthenticationSession constructor

WebAuthenticationSession()

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

It is implemented using ASWebAuthenticationSession on iOS 12.0+ and MacOS 10.15+ and SFAuthenticationSession on iOS 11.0.

Use an PlatformWebAuthenticationSession 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. PlatformWebAuthenticationSession ensures that only the calling app's session receives the authentication callback, even when more than one app registers the same callback URL scheme.

NOTE: Remember to dispose it when you don't need it anymore.

Implementation

WebAuthenticationSession()
  : this.fromPlatformCreationParams(
      params: PlatformWebAuthenticationSessionCreationParams(),
    );