auth.signIn()
Log in an existing user, or login via a third-party provider.
final res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password');
final user = res.data?.user;
final error = res.error;
Notes
- A user can sign up via email, phone number.
- If you provide
email
without apassword
, the user will be sent a magic link. - The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on app.supabase.com
- Similarly, if you provide
phone
without apassword
, the user will be sent a one time password. - If you are looking to sign users in with OAuth in Flutter apps, go to
signInWithProvider()
.
Examples
Sign in with email.
final res = await supabase.auth.signIn(email: 'example@email.com', password: 'example-password');
final user = res.data?.user;
final error = res.error;
Sign in with magic link.
If email is provided, but no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
final res = await supabase.auth.signIn(email: 'example@email.com');
final error = res.error;
Get OAuth sign in URL.
Passing provider parameter to signIn()
will return a URL to sign your user in via OAuth.
If you are looking to sign in a user via OAuth on Flutter app, go to signInWithProvider()
.
final res = await supabase.auth.signIn(provider: Provider.github);
final url = res.data?.url;
final error = res.error;