JavaScript: Create a new user

Creates a new user.

Be aware that if a user account exists in the system you may get back an error message that attempts to hide this information from the user. This method has support for PKCE via email signups. The PKCE flow cannot be used when autoconfirm is enabled.

Parameters

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'
    }
  }
)