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.

When this API is used to convert a guest user account to a regular registered user, the BackendlessUser argument must have the objectId property set to the value returned from the Guest Login API.

- (void)registerUserWithUser:(BackendlessUser * _Nonnull)user responseHandler:^(BackendlessUser * _Nonnull)responseHandler errorHandler:^(Fault * _Nonnull)errorHandler;
func registerUser(user: BackendlessUser, responseHandler: ((BackendlessUser) -> Void)!, errorHandler: ((Fault) -> Void)!)

Return value

The return value is a BackendlessUser object representing the registered user. The objectId property contains a value assigned by the server. The registration API does not login the user.

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
BackendlessUser *user = [BackendlessUser new];
user.email = @"james.bond@mi6.co.uk";
user.password = @"iAmWatchingU";

[Backendless.shared.userService registerUserWithUser:user responseHandler:^(BackendlessUser *registeredUser) {
    NSLog(@"User registration completed");
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
let user = BackendlessUser()
user.email = "james.bond@mi6.co.uk"
user.password = "iAmWatchingU"

Backendless.shared.userService.registerUser(user: user, responseHandler: { registeredUser in
    print("User registration completed")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

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,  click the Messaging icons in the vertical icon bar in Backendless console and select the EMAILS tab. Use the User made registration template.