signInWithPassword()

Log in an existing user with an email and password or phone and password.

1const { data, error } = await supabase.auth.signInWithPassword({
2  email: 'example@email.com',
3  password: 'example-password',
4})

Parameters#

  • SignInWithPasswordCredentialsrequired
    reflection
    |
    reflection

    No description provided.

      Properties
    • object
      required
      object

      No description provided.

        Properties
      • phonerequired
        string

        The user's phone number.

      • passwordrequired
        string

        The user's password.

      • optionsoptional
        object

        No description provided.

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

    • object
      required
      object

      No description provided.

        Properties
      • passwordrequired
        string

        The user's password.

      • emailrequired
        string

        The user's email address.

      • optionsoptional
        object

        No description provided.

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

Notes#

  • Requires either an email and password or a phone number and password.

Examples#

Sign in with email and password#

1const { data, error } = await supabase.auth.signInWithPassword({
2  email: 'example@email.com',
3  password: 'example-password',
4})

Sign in with phone and password#

1const { data, error } = await supabase.auth.signInWithPassword({
2  phone: '+13334445555',
3  password: 'some-password',
4})
5
6// After receiving a SMS with a OTP.
7const { data, error } = await supabase.auth.verifyOtp({
8  phone: '+13334445555',
9  token: '123456',
10})