Skip to content

User Registration

The user registration API can be used to create user accounts in the application. A registration request must provide a user object as a collection of key/value properties. The collection must contain all the required properties which must include a property marked as identity as well as the "password" property. The default identity property is "email", however, it can be changed in Backendless Console. Additionally, the "email" property is required if the application is configured to confirm email addresses for the registered users.

Non-Blocking API

The method call does not block - it returns immediately. The AsyncCallback argument receives either the response or the fault returned by the Backendless servers.

Backendless.UserService.register( user, new AsyncCallback<BackendlessUser>() );

where:

Argument                Description
user an instance of the BackendlessUser class which contains property values for the account registration.
callback an object which receives either a return value or an error from the server. The return value from the server is an instance of the BackendlessUser class with the ID assigned by the server-side. The class of the callback object must implement the AsyncCallback<BackendlessUser> interface.

Blocking API

public BackendlessUser Backendless.UserService.register( BackendlessUser userObj ) 
                                                  throws BackendlessException;

Error Codes

The following errors may occur during User Registration API calls. See the Error Handling section for details on how to retrieve the error code when the server returns an error.

Error Code
Description
2002
Invalid application info (application id or api key)
3009
User registration is disabled for the application
3010
User registration has an unknown property and dynamic properties are disabled for this version of the application
3011
Missing "password" property
3012
Required property is missing
3013
Missing value for the identity property
3014
External registration failed with an error.
3021
General user registration error. Details included with the error message.
3033
User with the same identity already exists
3038
Missing application-id or collection of properties for the registering user
3039
Property "id" cannot be used in the registration call
3040
Email address is in the wrong format
3041
A value for a required property is missing
3043
Duplicate properties in the registration request
8000
Property value exceeds the length limit

Non-Blocking API Sample

// do not forget to call Backendless.initApp when your app initializes

BackendlessUser user = new BackendlessUser();
user.setProperty( "email", "james.bond@mi6.co.uk" );
user.setPassword( "iAmWatchingU" );

Backendless.UserService.register( user, new AsyncCallback<BackendlessUser>()
{
  public void handleResponse( BackendlessUser registeredUser )
  {
    // user has been registered and now can login
  }

  public void handleFault( BackendlessFault fault )
  {
    // an error has occurred, the error code can be retrieved with fault.getCode()
  }
} );

Blocking API Sample

// do not forget to call Backendless.initApp when your app initializes

BackendlessUser user = new BackendlessUser();
user.setProperty( "email", "james.bond@mi6.co.uk" );
user.setPassword( "iAmWatchingU" );

try
{
  user = Backendless.UserService.register( user );
}
catch( BackendlessException exception )
{
  BackendlessFault fault = exception.getFault();
  // an error has occurred, the error code can be retrieved with fault.getCode()
}

Turning Registration Off

User registration can be disabled for a particular version of the application using the Backendless Console:

  1. Login to the console and select the application.
  2. Click the Users icon in the vertical icon menu on the left.
  3. Click User Registration.

The Registration toggle turns the registration API on or off. When the registration is turned off and a user attempts to register, the system returns error 3009.

registration-togglev4.zoom70

Email Confirmations

Backendless can send out an email requesting new registered users to confirm their email address. This feature can be configured in the Backendless Console:

  1. Log into the console and select the application.
  2. Click the Users icon in the vertical icon menu on the left.
  3. Click User Registration.

email-confirmationv4.zoom70

When email confirmations are turned on (the feature is disabled by default), the "email" user property is required and must contain a value formatted as an email address. To configure the text of the email message, select Email Templates from the Users menu in the console and select the User made registration event.