Creates a new user. This function should only be called on a server. Never expose your service_role
key in the browser.
email_confirm
or phone_confirm
to true. Both arguments default to false.createUser()
will not send a confirmation email to the user. You can use inviteUserByEmail()
if you want to send them an email invite instead.email_confirm
or phone_confirm
param to true
.const { data, error } = await supabase.auth.admin.createUser({ email: 'user@email.com', password: 'password', user_metadata: { name: 'Yoda' } })
const { data, error } = await supabase.auth.admin.createUser({ email: 'user@email.com', email_confirm: true })
const { data, error } = await supabase.auth.admin.createUser({ phone: '1234567890', phone_confirm: true })