Skip to main content
Version: v2 RC

signUp()

Creates a new user.

const { data, error } = await supabase.auth.signUp({
email: 'example@email.com',
password: 'example-password',
})

Parameters

  • SignUpWithPasswordCredentialsrequiredreflection | reflection

    No description provided.

      Properties
    • objectrequiredobject

      No description provided.

        Properties
      • phonerequiredstring

        The user's phone number.

      • passwordrequiredstring

        The user's password.

      • optionsoptionalobject

        No description provided.

          Properties
        • captchaTokenoptionalstring

          Verification token received when the user completes the captcha on the site.

        • dataoptionalobject

          A custom data object to store the user's metadata. This maps to the auth.users.user_metadata column.

          The data should be a JSON object that includes user-specific info, such as their first and last name.

    • objectrequiredobject

      No description provided.

        Properties
      • passwordrequiredstring

        The user's password.

      • emailrequiredstring

        The user's email address.

      • optionsoptionalobject

        No description provided.

          Properties
        • captchaTokenoptionalstring

          Verification token received when the user completes the captcha on the site.

        • dataoptionalobject

          A custom data object to store the user's metadata. This maps to the auth.users.user_metadata column.

          The data should be a JSON object that includes user-specific info, such as their first and last name.

        • emailRedirectTooptionalstring

          The redirect url embedded in the email link

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 user is returned but session is null.
    • If Confirm email is disabled, both a user and a session are returned.
  • When the user confirms their email address, they are redirected to the SITE_URL by default. You can modify your SITE_URL or 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 registered is returned.
  • To fetch the currently logged-in user, refer to getUser().

Examples

Sign up.

const { data, error } = await supabase.auth.signUp({
email: 'example@email.com',
password: 'example-password',
})

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