auth.signUp()

Creates a new user.

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

Parameters

  • __namedParametersrequiredobject

    No description provided.

      Properties
    • passwordrequiredundefined | string

      The user's password.

    • emailrequiredundefined | string

      The user's email address.

  • optionsrequiredobject

    No description provided.

      Properties
    • redirectTooptionalundefined | string

      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.io
  • 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.io

Examples

Sign up.

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

Sign up with redirect.

Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for any URL path on your website (the base domain must be the same as the domain in your Auth settings).

const { user, session, error } = await supabase.auth.signUp({
provider: 'github'
}, {
redirectTo: 'https://example.com/welcome'
})

Sign up with third-party providers.

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

const { user, session, error } = await supabase.auth.signIn({
provider: 'github'
})

Sign up with scopes.

You can provide additional scopes to OAuth providers using the signIn() method.

const { user, session, error } = await supabase.auth.signIn({
provider: 'github'
}, {
scopes: 'repo gist notifications'
})
const oAuthToken = session.provider_token // use to access provider API