signInWithSSO method

Future<bool> signInWithSSO({
  1. String? providerId,
  2. String? domain,
  3. String? redirectTo,
  4. String? captchaToken,
  5. LaunchMode launchMode = LaunchMode.platformDefault,
})

Attempts a single-sign on using an enterprise Identity Provider. A successful SSO attempt will redirect the current page to the identity provider authorization page. The redirect URL is implementation and SSO protocol specific.

You can use it by providing a SSO domain. Typically you can extract this domain by asking users for their email address. If this domain is registered on the Auth instance the redirect will use that organization's currently active SSO Identity Provider for the login.

If you have built an organization-specific login page, you can use the organization's SSO Identity Provider UUID directly instead.

Returns true if the URL was launched successfully, otherwise either returns false or throws a PlatformException depending on the launchUrl failure.

await supabase.auth.signInWithSSO(
  domain: 'company.com',
);

Implementation

Future<bool> signInWithSSO({
  String? providerId,
  String? domain,
  String? redirectTo,
  String? captchaToken,
  LaunchMode launchMode = LaunchMode.platformDefault,
}) async {
  final ssoUrl = await getSSOSignInUrl(
    providerId: providerId,
    domain: domain,
    redirectTo: redirectTo,
    captchaToken: captchaToken,
  );
  return await launchUrl(
    Uri.parse(ssoUrl),
    mode: launchMode,
    webOnlyWindowName: '_self',
  );
}