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.
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.
Sign up the user#
To sign up the user, call signUp() with their email address and password:
_10async function signUpNewUser() {_10 const { data, error } = await supabase.auth.signUp({_10 email: 'example@email.com',_10 password: 'example-password',_10 options: {_10 redirectTo: 'https//example.com/welcome'_10 }_10 })_10}
When your user signs out, call signOut() to remove them from the browser session and any objects from localStorage:
_10async function signOut() {_10 const { error } = await supabase.auth.signOut()_10}
Sign in the user#
When your user signs in, call signInWithPassword() with their email address and password:
_10async function signInWithEmail() {_10 const { data, error } = await supabase.auth.signInWithPassword({_10 email: 'example@email.com',_10 password: 'example-password',_10 options: {_10 redirectTo: 'https//example.com/welcome'_10 }_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:
_10async function signOut() {_10 const { error } = await supabase.auth.signOut()_10}