IOSWebAuthenticationSession class
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.
NOTE for iOS: Available only on iOS 11.0+.
NOTE for MacOS: Available only on MacOS 10.15+.
Officially Supported Platforms/Implementations:
- iOS
- MacOS
- Inheritance
-
- Object
- PlatformInterface
- IOSWebAuthenticationSession
Constructors
- IOSWebAuthenticationSession(PlatformWebAuthenticationSessionCreationParams params)
- Constructs a IOSWebAuthenticationSession.
- IOSWebAuthenticationSession.static()
-
Provide static access.
factory
Properties
- callbackURLScheme ↔ String?
-
The custom URL scheme that the app expects in the callback URL.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
ID used internally.
final
- initialSettings ↔ WebAuthenticationSessionSettings?
-
Initial settings.
latefinal
- onComplete ↔ WebAuthenticationSessionCompletionHandler?
-
A completion handler the session calls when it completes successfully, or when the user cancels the session.
latefinal
- params → PlatformWebAuthenticationSessionCreationParams
-
The parameters used to initialize the
PlatformWebAuthenticationSession
.finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url ↔ WebUri
-
A URL with the
http
orhttps
scheme pointing to the authentication webpage.latefinal
Methods
-
cancel(
) → Future< void> - Cancels the web authentication session.
-
canStart(
) → Future< bool> - Indicates whether the session can begin.
-
create(
{required WebUri url, String? callbackURLScheme, WebAuthenticationSessionCompletionHandler? onComplete, WebAuthenticationSessionSettings? initialSettings}) → Future< IOSWebAuthenticationSession> - Used to create and initialize a session.
-
dispose(
) → Future< void> - Disposes the web authentication session.
-
isAvailable(
) → Future< bool> -
Returns
true
if ASWebAuthenticationSession or SFAuthenticationSession is available. Otherwise returnsfalse
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
start(
) → Future< bool> - Starts the web authentication session.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited