Skip to main content

signUp()

Creates a new user.

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

Parameters

  • __namedParametersrequiredUserCredentials

    No description provided.

  • optionsrequiredobject

    No description provided.

      Properties
    • captchaTokenoptionalstring

      No description provided.

    • dataoptionalobject

      No description provided.

    • redirectTooptionalstring

      No description provided.

Notes

  • By default, the user will need to verify their email address before logging in. If you would like to change this, you can disable "Email Confirmations" by going to Authentication -> Settings on app.supabase.com
  • If "Email Confirmations" is turned on, a user is returned but session will be null
  • If "Email Confirmations" is turned off, both a user and a session will be returned
  • When the user confirms their email address, they will be redirected to localhost:3000 by default. To change this, you can go to Authentication -> Settings on app.supabase.com
  • If signUp() is called for an existing confirmed user:
    • If "Enable email confirmations" is enabled on the "Authentication" -> "Settings" page, an obfuscated / fake user object will be returned.
    • If "Enable email confirmations" is disabled, an error with a message "User already registered" will be returned.
  • To check if a user already exists, refer to getUser().

Examples

Sign up.

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

Sign up with additional user meta data.

const { user, session, error } = await supabase.auth.signUp(
{
email: 'example@email.com',
password: 'example-password',
},
{
data: {
first_name: 'John',
age: 27,
}
}
)

Sign up with third-party providers.

You can sign up with OAuth providers using the signIn() method.

Sign up with Phone.

Supabase supports Phone Auth. After a user has verified their number, they can use the signIn() method.

const { user, session, error } = await supabase.auth.signUp({
phone: '+13334445555',
password: 'some-password',
})

// After receiving an SMS with One Time Password.
let { session, error } = await supabase.auth.verifyOTP({
phone: '+13334445555',
token: '123456',
})