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

Registering Users

Registering Users

In Telerik Platform there are two different ways to register a user. The first and most standard is to register the user directly, supplying username, password, and any other profile information you need. The second is to use one of the supported third-party OAuth providers, such as Facebook, Google, and Microsoft Account. Both ways are described below.

Registering with Telerik Platform

Registering a user is quite straightforward. A user has only two required properties: Username and Password. Note that those two properties are case-sensitive (when using the RESTful API). As shown in the example, you often have custom properties (DisplayName, AvatarImage) along with the required.

  • The username must be unique for the application.
  • By default, anonymous users can register (create) users. This can be changed if necessary.
  • The user will be registered with the default role for the application.

Although you can set a role other than the default in your request, it will not take effect unless you use Master Key authentication. Using Master Key authentication is not recommended because you expose your application's master key which is a security risk. Instead, create the user account with the default role and then set the role that you want using the Telerik Platform portal.

 public async Task RegisterUser(EverliveApp app, string username, string password)
{
    var user = new User()
    {
        Username = username,
        Password = password
    };
    await app.WorkWith().Users().Create(user).ExecuteAsync();
}
Public Async Function RegisterUser(app As EverliveApp, username As String, password As String) As Task
    Dim user = New User() With { 
        .Username = username,
        .Password = password
    }
    Await app.WorkWith().Users().Create(user).ExecuteAsync()
End Function

After registering a user, the server will return the Id of the registered user along with its CreatedAt date on the server. Again, exactly the same type of result as you would get when you create an item of another content type.

Using a Supported OAuth Provider

When you want to create a user account without asking for username and password, you can utilize the Telerik Platform OAuth integration. More information about utilizing this feature can be found in the OAuth Providers section below.

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 supported by Telerik Platform. It works by providing a secret question and a secret answer fields when registering the user:

public async Task RegisterUser(EverliveApp app, string username, string password, object secretQuestionId, string secretAnswer)
{
    var user = new User()
    {
        Username = username,
        Password = password,
        SecretQuestion = secretQuestionId,
        SecretAnswer = secretAnswer
    };
    await app.WorkWith().Users().Create(user).ExecuteAsync();
}
 Public Async Function RegisterUser(app As EverliveApp, username As String, password As String, secretQuestionId As Object, secretAnswer As String) As Task
    Dim user = New User() With {
        .Username = username,
        .Password = password,
        .SecretQuestion = secretQuestionId,
        .SecretAnswer = secretAnswer
    }
    Await app.WorkWith().Users().Create(user).ExecuteAsync()
End Function

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.


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