auth.signInWithProvider()
Signs the user in using third party OAuth providers.
final res = await supabase.auth.signInWithProvider(Provider.github);
final error = res.error;
Notes
auth.signInWithProvider()
is only available onsupabase_flutter
- It will open the browser to the relevant login page.
Examples
Sign in with provider.
final res = await supabase.auth.signInWithProvider(Provider.github);
final error = res.error;
With redirectTo
Specify the redirect link to bring back the user via deeplink.
Note that redirectTo
should be null for Flutter Web.
final res = await supabase.auth.signInWithProvider(
Provider.github,
options: AuthOptions(
redirectTo: kIsWeb
? null
: 'io.supabase.flutter://reset-callback/'),
);
final error = res.error;
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.
const { user, session, error } = await supabase.auth.signIn({
provider: 'github'
}, {
scopes: 'repo gist notifications'
})
const oAuthToken = session.provider_token // use to access provider API