update()
Updates user data, if there is a logged in user.
const { user, error } = await supabase.auth.update({email: 'new@email.com'})
Parameters
attributesrequired
UserAttributes
No description provided.
Notes
User email: Email updates will send an email to both the user's current and new email with a confirmation link by default. To toggle this behavior off and only send a single confirmation link to the new email, toggle "Double confirm email changes" under "Authentication" -> "Settings" off.
User metadata: It's generally better to store user data in a table inside your public schema (i.e. public.users
).
Use the update()
method if you have data which rarely changes or is specific only to the logged in user.
Examples
Update email for authenticated user.
Sends a "Confirm Email Change" email to the new email address.
const { user, error } = await supabase.auth.update({email: 'new@email.com'})
Update password for authenticated user.
const { user, error } = await supabase.auth.update({password: 'new password'})
Update a user's metadata.
const { user, error } = await supabase.auth.update({
data: { hello: 'world' }
})