signUp()
Creates a new user.
1const { data, error } = await supabase.auth.signUp({
2 email: 'example@email.com',
3 password: 'example-password',
4})
Parameters#
SignUpWithPasswordCredentialsrequired
|reflectionreflectionNo description provided.
- required
objectobjectNo description provided.
phonerequired
stringThe user's phone number.
passwordrequired
stringThe user's password.
optionsoptional
objectNo description provided.
captchaTokenoptional
stringVerification token received when the user completes the captcha on the site.
dataoptional
objectA custom data object to store the user's metadata. This maps to the
auth.users.user_metadatacolumn.The
datashould be a JSON object that includes user-specific info, such as their first and last name.
Properties
Properties
- required
objectobjectNo description provided.
passwordrequired
stringThe user's password.
emailrequired
stringThe user's email address.
optionsoptional
objectNo description provided.
captchaTokenoptional
stringVerification token received when the user completes the captcha on the site.
dataoptional
objectA custom data object to store the user's metadata. This maps to the
auth.users.user_metadatacolumn.The
datashould be a JSON object that includes user-specific info, such as their first and last name.emailRedirectTooptional
stringThe redirect url embedded in the email link
Properties
Properties
Properties
Notes#
- By default, the user needs to verify their email address before logging in. To turn this off, disable Confirm email in your project.
- Confirm email determines if users need to confirm their email address after signing up.
- If Confirm email is enabled, a
useris returned butsessionis null. - If Confirm email is disabled, both a
userand asessionare returned.
- If Confirm email is enabled, a
- When the user confirms their email address, they are redirected to the
SITE_URLby default. You can modify yourSITE_URLor add additional redirect URLs in your project. - If signUp() is called for an existing confirmed user:
- If Confirm email is enabled in your project, an obfuscated/fake user object is returned.
- If Confirm email is disabled, the error message,
User already registeredis returned.
- To fetch the currently logged-in user, refer to
getUser().
Examples#
Sign up.#
1const { data, error } = await supabase.auth.signUp({
2 email: 'example@email.com',
3 password: 'example-password',
4})
Sign up with additional user metadata.#
1const { data, error } = await supabase.auth.signUp(
2 {
3 email: 'example@email.com',
4 password: 'example-password',
5 options: {
6 data: {
7 first_name: 'John',
8 age: 27,
9 }
10 }
11 }
12)