Flutter: Sign in a user through OAuth

Signs the user in using third-party OAuth providers.

Parameters

Examples

Sign in using a third-party provider

await supabase.auth.signInWithOAuth(
  OAuthProvider.github,
  redirectTo: kIsWeb ? null : 'my.scheme://my-host', // Optionally set the redirect link to bring back the user via deeplink.
  authScreenLaunchMode:
      kIsWeb ? LaunchMode.platformDefault : LaunchMode.externalApplication, // Launch the auth screen in a new webview on mobile.
);

With `redirectTo`

await supabase.auth.signInWithOAuth(
  OAuthProvider.github,
  redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
);

With scopes

await supabase.auth.signInWithOAuth(
  OAuthProvider.github,
  scopes: 'repo gist notifications'
);
...
// after user comes back from signin flow

final Session? session = supabase.auth.currentSession;
final String? oAuthToken = session?.providerToken;