signInWithOAuth()

Signs the user in using third party OAuth providers.

1await supabase.auth.signInWithOAuth(Provider.github);

Notes#

  • This method is used for signing in using a third-party provider.
  • Supabase supports many different third-party providers.

Examples#

Sign in using a third-party provider#

1await supabase.auth.signInWithOAuth(Provider.github);

With redirectTo#

Specify the redirect link to bring back the user via deeplink. Note that redirectTo should be null for Flutter Web.

1await supabase.auth.signInWithOAuth(
2  Provider.github,
3  redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
4);

With scopes#

If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token. You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider.

1await supabase.auth.signInWithOAuth(
2  Provider.github,
3  scopes: 'repo gist notifications'
4);
5...
6// after user comes back from signin flow
7
8final Session? session = supabase.auth.currentSession;
9final String? oAuthToken = session?.providerToken;