Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Registering Users

Registering Users

Registering, or signing up, a user with Telerik Platform is equivalent to creating an object in the built-in Users content type. The user object has only two required fields: username and password. They are used to authenticate the user when working with your application. Although not required, it is a good idea to specify DisplayName and Email as well.

Request:
    POST https://api.everlive.com/v1/your-app-id/Users 
Headers:
     Content-Type: application/json 
Payload - raw:
    { 
        "Username": "jsmith",
        "Password": "111111",
        "DisplayName": "John Smith",
        "Email": "john.smith@telerik.com"
    } 
Response:
    Status: 201 Created
    Content-Type: application/json
var user = {
    "Username": "jsmith",
    "Password": "111111",
    "DisplayName": "John Smith",
    "Email": "john.smith@telerik.com"
}

$.ajax({
    type: "POST",
    url: 'https://api.everlive.com/v1/your-app-id/Users',
    contentType: "application/json",
    data: JSON.stringify(user),
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
});

The response to the registration request contains the ID of the new user object along with its CreatedAt date on the server. This is the same type of result that you would get when creating an item of any custom content type.

A few important things to know when registering users:

  • The username field must be unique in the application. An error is returned otherwise.
  • If you create a user object without setting its role, the default role for the app is assigned.
  • The optional email field must be a valid email address and must be unique in the application.

Email Instead of Username

Often, people prefer to use their email to log into a system, instead of some username. The email is easily remembered and they most likely have to fill it in anyway. You can easily enable this for users of your app, you just have to set the email address to both Email and Username, without asking for username at all.

Secret Question and Answer

Users regularly forget their password. To allow them to recover their account, you can use the secret question and answer mechanism provided by Telerik Platform. It works by providing a secret question and a secret answer fields when registering the user:

Request:
    POST https://api.everlive.com/v1/your-app-id/Users 
Headers:
     Content-Type: application/json 
Payload - raw:
    { 
        "Username": "jsmith",
        "Password": "111111",
        "DisplayName": "John Smith",
        "Email": "john.smith@telerik.com"
        "SecretQuestionId": 1,
        "SecretAnswer": "dog"
    } 
Response:
    Status: 201 Created
    Content-Type: application/json
var user = {
    "Username": "jsmith",
    "Password": "111111",
    "DisplayName": "John Smith",
    "Email": "john.smith@telerik.com"
    "SecretQuestionId": 1,
    "SecretAnswer": "dog"
}

$.ajax({
    type: "POST",
    url: 'https://api.everlive.com/v1/your-app-id/Users',
    contentType: "application/json",
    data: JSON.stringify(user),
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
});

If those fields are present, they can be used for resetting the password for the account as explained in Recover User Account.

Note that the SecretQuestionId field only carries the secret question ID. It is up to you as a developer to decide where and how to match the ID to a secret question text so you can show it to the user when necessary.

Security Concerns

Have the following in mind when designing the security of your app:

By default, no authentication is required for the registration request, meaning everyone can create user accounts. This and the fact that new user accounts are assigned the default role, means that it is very easy for anyone to use your app with the default role's permissions. If you need to, you can easily change the defaults and disallow user registration with anonymous requests. However, this would mean that you need to devise another way to register your users.

Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.