signInWithWebUI method

Future<SignInResult> signInWithWebUI({
  1. AuthProvider? provider,
  2. SignInWithWebUIOptions? options,
})

Initiate sign in for a web-based flow, e.g. a social provider like Facebook, Google, or Apple.

If no provider is supplied, the default login page will be shown. By specifying a provider, the webpage will open directly to the provider's login page.

Optionally accepts plugin options which allow customizing provider-specific behavior, e.g. the Cognito User Pool.

For more information, see the Amplify docs.

Examples

import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:amplify_flutter/amplify_flutter.dart';
Future<void> socialSignIn() async {
  try {
    final result = await Amplify.Auth.signInWithWebUI(
      provider: AuthProvider.google,
    );
    return _handleSignInResult(result);
  } on AuthException catch (e) {
    safePrint('Error signing in: ${e.message}');
  }
}

Implementation

Future<SignInResult> signInWithWebUI({
  AuthProvider? provider,
  SignInWithWebUIOptions? options,
}) =>
    identifyCall(
      AuthCategoryMethod.signInWithWebUI,
      () => defaultPlugin.signInWithWebUI(
        provider: provider,
        options: options,
      ),
    );