updateUser()
Updates user data, if there is a logged in user.
1const { data, error } = await supabase.auth.updateUser({
2 data: { hello: 'world' }
3})
Parameters#
UserAttributesrequired
object
No description provided.
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.emailoptional
string
The user's email.
passwordoptional
string
The user's password.
phoneoptional
string
The user's phone.
Properties
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.
1const { data, error } = await supabase.auth.updateUser({email: 'new@email.com'})
Update the password for an authenticated user#
1const { data, error } = await supabase.auth.updateUser({password: 'new password'})
Update the user's metadata#
1const { data, error } = await supabase.auth.updateUser({
2 data: { hello: 'world' }
3})