JavaScript: Create a new user (original) (raw)

Creates a new user.

Parameters

(Required)

Examples

Sign up with an email and password

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

Sign up with a phone number and password (SMS)

const { data, error } = await supabase.auth.signUp({
  phone: '123456789',
  password: 'example-password',
  options: {
    channel: 'sms'
  }
})

Sign up with a phone number and password (whatsapp)

const { data, error } = await supabase.auth.signUp({
  phone: '123456789',
  password: 'example-password',
  options: {
    channel: 'whatsapp'
  }
})

Sign up with additional user metadata

const { data, error } = await supabase.auth.signUp(
  {
    email: 'example@email.com',
    password: 'example-password',
    options: {
      data: {
        first_name: 'John',
        age: 27,
      }
    }
  }
)

Sign up with a redirect URL

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