Create a user
Creates a new user.
- To confirm the user's email address or phone number, set
email_confirm
orphone_confirm
to true. Both arguments default to false. createUser()
will not send a confirmation email to the user. You can useinviteUserByEmail()
if you want to send them an email invite instead.- If you are sure that the created user's email or phone number is legitimate and verified, you can set the
email_confirm
orphone_confirm
param totrue
.
Parameters
attributes
REQUIRED
AdminUserAttributesAttributes to create the user with.
email
REQUIRED
StringThe email address of the user.
password
REQUIRED
StringThe password of the user.
phone
Optional
StringThe phone number of the user.
userMetadata
Optional
Map<String, dynamic>A custom data object to store the user's metadata. This maps to the `auth.users.user_metadata` column.
appMetadata
Optional
Map<String, dynamic>A custom data object to store the user's application specific metadata. This maps to the `auth.users.app_metadata` column.
emailConfirm
Optional
boolWhether to confirm the user's email address.
phoneConfirm
Optional
boolWhether to confirm the user's phone number.
banDuration
Optional
StringDetermines how long a user is banned for. Some possible durations include '300ms', '2h45m'.
final res = await supabase.auth.admin.createUser(AdminUserAttributes(
email: '[email protected]',
password: 'password',
userMetadata: {'name': 'Yoda'},
));