Home

Login With Magic Link

Magic links are a form of passwordless logins where users click on a link sent to their email address to log in to their accounts. Magic links only work with email addresses. By default, a user can only request a magic link once every 60 seconds.

Overview#

Setting up Magic Link logins for your Supabase application.

  1. For Site URL, enter the final (hosted) URL of your app.
  2. For Auth Providers, enable email provider.

Add login code to your client app#

When your user signs in, call signInWithOtp() with their email address:

async function signInWithEmail() {
  const { data, error } = await supabase.auth.signInWithOtp({
    email: 'example@email.com',
    options: {
      emailRedirectTo: 'https://example.com/welcome',
    },
  })
}

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

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

Resources#

Need some help?

Not to worry, our specialist engineers are here to help. Submit a support ticket through the Dashboard.