Skip to main content
Version: v1-dev

auth.signIn()

Log in an existing user, or login via a third-party provider.

final GotrueSessionResponse res = await supabase.auth.signIn(
email: 'example@email.com',
password: 'example-password',
);

final User? user = res.user;

Notes

  • A user can sign up via email, phone number.
  • If you provide email without a password, 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 a password, 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 GotrueSessionResponse res = await supabase.auth.signIn(
email: 'example@email.com',
password: 'example-password',
);

final User? user = res.user;

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 GotrueSessionResponse res = await supabase.auth.signIn(
email: 'example@email.com',
);

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 GotrueSessionResponse res = await supabase.auth.signIn(
provider: Provider.github,
);

final User? user = res.user;