Skip to main content
Version: v1-dev

auth.signInWithProvider()

Signs the user in using third party OAuth providers.

await supabase.auth.signInWithProvider(Provider.github);

Notes

  • auth.signInWithProvider() is only available on supabase_flutter
  • It will open the browser to the relevant login page.

Examples

Sign in with provider.

await supabase.auth.signInWithProvider(Provider.github);

With redirectTo

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

await supabase.auth.signInWithProvider(
Provider.github,
options: const AuthOptions(
redirectTo: kIsWeb ? null : 'io.supabase.flutter://reset-callback/',
),
);

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.

await supabase.auth.signInWithProvider(Provider.github,
options: const AuthOptions(scopes: 'repo gist notifications'));
...
// after user comes back from signin flow

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