signUp()
Creates a new user.
1const { data, error } = await supabase.auth.signUp({
2 email: 'example@email.com',
3 password: 'example-password',
4})
Parameters#
SignUpWithPasswordCredentialsrequired
|reflection
reflection
No description provided.
- required
object
object
No description provided.
phonerequired
string
The user's phone number.
passwordrequired
string
The user's password.
optionsoptional
object
No description provided.
captchaTokenoptional
string
Verification token received when the user completes the captcha on the site.
dataoptional
object
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.
Properties
Properties
- required
object
object
No description provided.
passwordrequired
string
The user's password.
emailrequired
string
The user's email address.
optionsoptional
object
No description provided.
captchaTokenoptional
string
Verification token received when the user completes the captcha on the site.
dataoptional
object
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.emailRedirectTooptional
string
The 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
user
is returned butsession
is null. - If Confirm email is disabled, both a
user
and asession
are returned.
- If Confirm email is enabled, a
- When the user confirms their email address, they are redirected to the
SITE_URL
by default. You can modify yourSITE_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.#
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)