create method

  1. @SupportedPlatforms.new(platforms: [IOSPlatform(), MacOSPlatform()])
Future<PlatformWebAuthenticationSession> create({
  1. required WebUri url,
  2. String? callbackURLScheme,
  3. WebAuthenticationSessionCompletionHandler? onComplete,
  4. WebAuthenticationSessionSettings? initialSettings,
})

Used to create and initialize a session.

url represents a URL with the http or https scheme pointing to the authentication webpage.

callbackURLScheme represents the custom URL scheme that the app expects in the callback URL.

onComplete represents a completion handler the session calls when it completes successfully, or when the user cancels the session.

initialSettings represents initial settings.

Officially Supported Platforms/Implementations:

  • iOS WKWebView
  • macOS WKWebView

Parameters - Officially Supported Platforms/Implementations:

  • url: all platforms
  • callbackURLScheme: all platforms
  • onComplete: all platforms
  • initialSettings: all platforms

Use the PlatformWebAuthenticationSession.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(platforms: [IOSPlatform(), MacOSPlatform()])
Future<PlatformWebAuthenticationSession> create({
  required WebUri url,
  String? callbackURLScheme,
  WebAuthenticationSessionCompletionHandler onComplete,
  WebAuthenticationSessionSettings? initialSettings,
}) {
  throw UnimplementedError(
    'create is not implemented on the current platform',
  );
}