signUp lets you create user accounts for your web app. This API will return a promise that gets resolved once the user account has been created.
userbase.signUp({
username: 'example-username',
password: 'example-password'
}).then((user) => {
// user account created
}).catch((e) => console.error(e))
Parameters
-
username [string | Len: 1-100] - The username for the account to be created.
-
password [string | Len: 6-1000] - The password for the account to be created.
-
email [string | optional] - The email for the account to be created.
-
profile [object | optional | Key Len: 1-20 | Val Len: 1-1000 | Keys: 1-100] - A place where to store some information about the account to be created. All keys and values must be strings.
-
rememberMe [string | optional] - The persistence mode for the user's session. Valid values are 'local', 'session', and 'none'. When set to 'local', the session persists even after the browser window gets closed. When set to 'session', the session persists until the browser window gets closed. And 'none' disables session persistence completely. Defaults to 'session'.
Result
-
user [object] - Contains information about the new user.
- username [string] - The user's username.
- userId [string] - The user's unique identifier.
- email [string] - The user's email.
- profile [object] - 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.
-
When rememberMe is set to 'session' or 'local', the user's encryption key will be stored in clear in the browser's session or local storage respectively. If you want to avoid this, you will need to set rememberMe to 'none'. When rememberMe is 'none', the user will always have to login with the username and password when visiting your web app.
Errors
- ParamsMustBeObject
- UsernameMissing
- UsernameAlreadyExists
- UsernameCannotBeBlank
- UsernameMustBeString
- UsernameTooLong
- PasswordMissing
- PasswordCannotBeBlank
- PasswordTooShort
- PasswordTooLong
- PasswordMustBeString
- EmailNotValid
- ProfileMustBeObject
- ProfileCannotBeEmpty
- ProfileHasTooManyKeys
- ProfileKeyMustBeString
- ProfileKeyTooLong
- ProfileValueMustBeString
- ProfileValueCannotBeBlank
- ProfileValueTooLong
- RememberMeValueNotValid
- TrialExceededLimit
- AppIdNotSet
- AppIdNotValid
- UserAlreadySignedIn
- ServiceUnavailable