Skip to main content
Version: v2 RC

updateUser()

Updates user data, if there is a logged in user.

const { data, error } = await supabase.auth.updateUser({
data: { hello: 'world' }
})

Parameters

  • UserAttributesrequiredobject

    No description provided.

      Properties
    • dataoptionalobject

      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.

    • emailoptionalstring

      The user's email.

    • passwordoptionalstring

      The user's password.

    • phoneoptionalstring

      The user's phone.

Notes

  • In order to use the updateUser() method, the user needs to be signed in first.
  • By Default, email updates sends a confirmation link to both the user's current and new email. To only send a confirmation link to the user's new email, disable Secure email change in your project's email auth provider settings.

Examples

Update the email for an authenticated user

Sends a "Confirm Email Change" email to the new email address.

const { data, error } = await supabase.auth.updateUser({email: 'new@email.com'})

Update the password for an authenticated user

const { data, error } = await supabase.auth.updateUser({password: 'new password'})

Update the user's metadata

const { data, error } = await supabase.auth.updateUser({
data: { hello: 'world' }
})