Docs : SDK : updateUser
updateUser lets you update a user's account. This API will return a promise that gets resolved once the user account has been updated.
userbase.updateUser({ username, currentPassword, newPassword, email, profile })
.then(() => {
// user account updated
})
.catch((e) => console.error(e))
Parameters
-
username [string | Len: 1-50] - The new username for the account.
-
currentPassword [string | Len: 6-1000] - The current password for the account. Required if newPassword provided.
-
newPassword [string | Len: 6-1000] - The new password for the account.
-
email [string | null | undefined | false] - The new email for the account. If explicitly set to a falsey value, deletes the user's email.
-
profile [object | null | undefined | false | Key Len: 1-20 | Val Len: 0-1000 | Keys: 1-100] - The new profile for the account. All keys and values must be strings. If explicitly set to a falsey value, deletes the user's profile.
Notes
-
The user's password is never sent to the server. A hash gets computed client-side, and only the hash is transmitted and stored server-side.
-
The username, email, and profile are not end-to-end encrypted. They are encrypted in transit and at rest, but you will be able to see this information in the Admin panel.
Errors
- ParamsMustBeObject
- ParamsMissing
- UsernameAlreadyExists
- UsernameMustBeString
- UsernameCannotBeBlank
- UsernameTooLong
- CurrentPasswordMissing
- CurrentPasswordIncorrect
- PasswordMustBeString
- PasswordCannotBeBlank
- PasswordTooShort
- PasswordTooLong
- EmailNotValid
- ProfileMustBeObject
- ProfileCannotBeEmpty
- ProfileHasTooManyKeys
- ProfileKeyMustBeString
- ProfileKeyTooLong
- ProfileValueMustBeString
- ProfileValueTooLong
- AppIdNotSet
- AppIdNotValid
- UserNotFound
- UserNotSignedIn
- ServiceUnavailable