Dart Reference v2.0

Create a new user

Creates a new user.

  • 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:
    • 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.
Parameters
    email
    Optional
    String

    User's email address to be used for email authentication.

    phone
    Optional
    String

    User's phone number to be used for phone authentication.

    password
    REQUIRED
    String

    Password to be used for authentication.

    emailRedirectTo
    Optional
    String

    The URL to redirect the user to after they confirm their email address.

    data
    Optional
    Map<String, dynamic>

    The user's metadata to be stored in the user's object.

    captchaToken
    Optional
    String

    The captcha token to be used for captcha verification.

    channel
    Optional
    OtpChannel

    Messaging channel to use (e.g. whatsapp or sms). Defaults to OtpChannel.sms.


final AuthResponse res = await supabase.auth.signUp(
  email: '[email protected]',
  password: 'example-password',
);
final Session? session = res.session;
final User? user = res.user;