Skip to main content

Login With Email

Overview#

Setting up Email logins for your Supabase application.

Add Email into your Supabase Project#

  • 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 (this is important)
  • Under Email Auth turn Enable Email Signup to ON
  • Click Save

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#