Skip to content

Enable/Disable User

The Users table is where registered users are stored in Backendless. The table has a special, system-level column called userStatus:

userstatus-column

As you can see in the screenshot above, the user accounts may have one of the following three statuses:

  • ENABLED - user can login into the app.
  • DISABLED - user cannot login into the app.
  • EMAIL_CONFIRMATION_PENDING - this is an intermediary state of a user account until they confirm their email address by clicking a link in the email message sent to them. Users in this status cannot login. When a user confirms their email address, Backendless automatically changes this status to ENABLED. For more information about email confirmations, see the User Registration section of this guide.

It is possible to change user status programmatically using the API described below. The APIs can be used only from cloud code implemented in either Java, JS or Codeless. This restriction is in place to make sure the security of your app is not compromised. The API allows the following status transitions:

From
To
ENABLED
DISABLED
DISABLED
ENABLED
EMAIL_CONFIRMATION_PENDING
ENABLED
EMAIL_CONFIRMATION_PENDING
DISABLED

Method

PUT

URL

https://api.backendless.com/<application-id>/<CLOUDCODE-api-key>/users/<user-objectId>/status

where:

Argument                Description
<application-id> The ID of your application generated upon its creation. You can obtain the value in the Manage > App Settings section of the Backendless Console.
<CLOUDCODE-api-key> Cloud Code API key of your application. You can obtain the value in the Manage > App Settings section of the Backendless Console.
<user-objectId> A value of the "objectId" property/column for the user account to enable or disable.

Request Headers

Content-Type:application/json

where

Argument                Description
Content-Type Must be set to application/json. This header is mandatory.

Request Body

{  
  "userStatus" : "ENABLED" | "DISABLED"]  
}

Response Body

N/A