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: 'example-new-username',
currentPassword: 'example-password',
newPassword: 'example-new-password',
email: 'example@email.com',
profile: { example: 'value' }
}).then(() => {
// user account updated
}).catch((e) => console.error(e))
Parameters
-
username [string | Len: 1-100 | optional] - The new username for the account.
-
currentPassword [string | Len: 6-1000 | optional] - The current password for the account. Required if newPassword provided.
-
newPassword [string | Len: 6-1000 | optional] - The new password for the account.
-
email [string | null | undefined | false | optional] - 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: 1-1000 | Keys: 1-100 | optional] - 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.
-
You can listen for the updated user by passing an updateUserHandler to init.
Errors
- ParamsMustBeObject
- ParamsMissing
- UsernameAlreadyExists
- UsernameMustBeString
- UsernameCannotBeBlank
- UsernameTooLong
- CurrentPasswordMissing
- CurrentPasswordIncorrect
- PasswordAttemptLimitExceeded
- PasswordMustBeString
- PasswordCannotBeBlank
- PasswordTooShort
- PasswordTooLong
- EmailNotValid
- ProfileMustBeObject
- ProfileCannotBeEmpty
- ProfileHasTooManyKeys
- ProfileKeyMustBeString
- ProfileKeyTooLong
- ProfileValueMustBeString
- ProfileValueCannotBeBlank
- ProfileValueTooLong
- AppIdNotSet
- AppIdNotValid
- UserNotFound
- UserNotSignedIn
- TooManyRequests
- ServiceUnavailable