Skip to main content
Visit Key Concepts page to learn the most important QuickBlox concepts.

Before you begin

  1. Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
  2. Configure QuickBlox SDK for your app. Check out Setup page for more details.
  3. Create a user session to be able to use QuickBlox functionality. See Authentication page to learn how to do it.

Create user

It’s recommended to manage user creation at your backend for production. To learn more you can refer to QuickBlox API documentation. For POCs/MVPs or during development you may want to create users on the fly, you can use create() method. Create a user using the code snippet below. Only login (or email) and password are required. Other fields are optional.
JavaScript
Security & PrivacyIt’s recommended to disable permission to create users with application session on production apps once user creation is implemented on your backend.Email, full name, facebookId and phone number are PII, configure session permissions according to your privacy requirements.

Retrieve users

Get a list of users using the listUsers() method. The code snippet below shows how to get a list of users created between the two given dates, sorted in ascending order, with 50 users on the page.
JavaScript
If you want to retrieve only users updated after some specific date time, you can use operators. This is useful if you cache users somehow and do not want to obtain the whole list of your users on every app start. Thus, you can use search and sort operators to list users on the page so that it is easier to see specific users. If you want to get a paginated list of users from the server, you can set the following fields of the filter:

Search operators

You can use search operators to get more specific search results. The request below will return users by IDs.
JavaScript
Here are the search operators you can use to search for the exact data that you need.

Sort operators

You can use sort operators to order the search results. The request below will return users by the created_at field sorted in descending order.
JavaScript
Here are the sort operators you can use to order the search results.

Retrieve users by ID

To get a list of users by ID for a current account, use the following code snippet.
JavaScript

Retrieve user by login

To get a list of users by login for a current account, use the following code snippet.
JavaScript

Retrieve user by email

To get a list of users by email for a current account, use the following code snippet.
JavaScript

Retrieve users by full name

To get a list of users by full name for a current account, use the following code snippet. Search requires min 3 characters.
JavaScript

Retrieve users by phone number

To get a list of users by phone number for a current account, use the following code snippet.
JavaScript

Retrieve user by external user ID

If you have your own database with users (we call these databases as “external databases”), you can use External User ID (ExternalID field) in QBUser model to link users from QuickBlox with users from your external database.
JavaScript

Retrieve users by tags

To get a list of users by tags for a current account, use the following code snippet.
JavaScript

Delete user

A user can delete himself from the platform.
JavaScript

Reset user password

It’s possible to reset a password via email.
JavaScript
Make sure to enable the email confirmation. This functionality allows application users to confirm their emails. If a user doesn’t confirm the email, the emails won’t be sent to this user. As a result, a password reset functionality won’t work. To enable the email confirmation, proceed as follows:
  1. Go to the Dashboard => YOUR_APP => Users => Settings => User registration confirmation and check the box.
  2. Click the Save button.
A password reset functionality is available for the Enterprise plan. Contact the sales team for more details.

Update user

Update a user profile by calling the updateUser() method. If you want to change your password, you need to provide 2 parameters: password and old_password. As a result, the updated user entity will be returned. You can update any other field of the user using the update() method. Thus, the snippet below shows how to update a tag_list and custom_data fields.
JavaScript

Set user avatar

To set a user avatar, just upload a file to the QuickBlox cloud storage and connect it to the user. To upload the file to the QuickBlox cloud storage, call the createAndUpload() method. Now that the file is uploaded, get the ID of the uploaded file. To connect the file to the user, set the ID of the uploaded file to the blob_id field of the user and call the update() method. As a result, the user avatar gets updated.
JavaScript
Pass the following arguments to the update() method.

Get user avatar

Now, other users can get access to your avatar by using the code snippet below. As a result, you will receive a private URL in the response. See this section to learn more about file URLs.
JavaScript