Update a user
Updates user data for a logged in user.
- 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.
Parameters
attributes
REQUIRED
UserAttributesdata
Optional
objectA custom data object to store the user's metadata. This maps to the `auth.users.raw_user_meta_data` column. The `data` should be a JSON object that includes user-specific info, such as their first and last name.
email
Optional
stringThe user's email.
nonce
Optional
stringThe nonce sent for reauthentication if the user's password is to be updated. Call reauthenticate() to obtain the nonce first.
password
Optional
stringThe user's password.
phone
Optional
stringThe user's phone.
options
Optional
objectemailRedirectTo
Optional
string
const { data, error } = await supabase.auth.updateUser({
email: 'new@email.com'
})