Skip to main content

Login With Email

Overview

Setting up Email logins for your Supabase application.

Configure email settings

  • Go to your Supabase Project Dashboard
  • In the left sidebar, click the Authentication icon (near the top)
  • Click Settings from the list to go to the Authentication Settings page
  • Enter the final (hosted) URL of your app under Site URL
  • Under Email Auth turn Enable Email Signup to ON
  • Click Save
Self hosting

For self-hosting, you can update your project configuration using the files and environment variables provided. See the self-hosting docs for details.

Add login code to your client app

Add logins using our client libraries:

const { user, error } = await supabase.auth.signIn({
email: 'example@email.com',
password: 'example-password',
})

Add this function which you can call from a button, link, or UI element.

async function signInWithEmail() {
const { user, error } = await supabase.auth.signIn({
email: 'example@email.com',
password: 'example-password',
})
}

To log out:

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

Resources