Python: Create a new user (original) (raw)
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
By default, when the user confirms their email address, they are redirected to the SITE_URL. You can modify your
SITE_URL
or add additional redirect URLs in your project.If sign_up() is called for an existing confirmed user:
- When both Confirm email and Confirm phone (even when phone provider is disabled) are enabled in your project, an obfuscated/fake user object is returned.
- When either Confirm email or Confirm phone (even when phone provider is disabled) is disabled, the error message,
User already registered
is returned.
To fetch the currently logged-in user, refer to get_user().
Parameters
credentials
(Required)
undefined
Examples
Sign up with an email and password
response = supabase.auth.sign_up(
{
"email": "email@example.com",
"password": "password",
}
)
Sign up with a phone number and password (SMS)
response = supabase.auth.sign_up(
{
"phone": "123456789",
"password": "password",
}
)
Sign up with a phone number and password (whatsapp)
response = supabase.auth.sign_up(
{
"phone": "123456789",
"password": "password",
"options": {"channel": "whatsapp"},
}
)
Sign up with additional user metadata
response = supabase.auth.sign_up(
{
"email": "email@example.com",
"password": "password",
"options": {"data": {"first_name": "John", "age": 27}},
}
)
Sign up with a redirect URL
response = supabase.auth.sign_up(
{
"email": "hello1@example.com",
"password": "password",
"options": {
"email_redirect_to": "https://example.com/welcome",
},
}
)