Auth

Login With Email

Set up Email Logins for your Supabase application.

  • Enable the email provider in your Supabase Project
  • Configure the Site URL and any additional redirect URLs in the authentication management tab.
  • The Site URL represents the default URL that the user will be redirected to after clicking on the email signup confirmation link.

Sign up the user

To sign up the user, call signUp() with their email address and password:


_10
async function signUpNewUser() {
_10
const { data, error } = await supabase.auth.signUp({
_10
_10
password: 'example-password',
_10
options: {
_10
emailRedirectTo: 'https://example.com/welcome',
_10
},
_10
})
_10
}

Sign in the user

When your user signs in, call signInWithPassword() with their email address and password:


_10
async function signInWithEmail() {
_10
const { data, error } = await supabase.auth.signInWithPassword({
_10
_10
password: 'example-password',
_10
})
_10
}

Sign out the user

When your user signs out, call signOut() to remove them from the browser session and any objects from localStorage:


_10
async function signOut() {
_10
const { error } = await supabase.auth.signOut()
_10
}

Resources