JavaScript: Create a user

Creates a new user. This function should only be called on a server. Never expose your service_role key in the browser.

Parameters

Examples

With custom user metadata

const \{ data, error \} = await supabase.auth.admin.createUser(\{
  email: '[email protected]',
  password: 'password',
  user_metadata: \{ name: 'Yoda' \}
\})

Auto-confirm the user's email

const \{ data, error \} = await supabase.auth.admin.createUser(\{
  email: '[email protected]',
  email_confirm: true
\})

Auto-confirm the user's phone number

const \{ data, error \} = await supabase.auth.admin.createUser(\{
  phone: '1234567890',
  phone_confirm: true
\})