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

Registering Users

Registering Users

There are two different ways to register a user with Telerik Platform. The first and most standard is to register the user directly, supplying a username, a 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, Microsoft Account, and Active Directory Federation Services (AD FS). Both ways are described below.

Register with Telerik Platform

Registering a user is quite straightforward. A user has only two required properties: Username and Password. Please note, that those two properties are case-sensitive(when using the RESTful API). As it is shown in the example, you will 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 RequestResult registerUser(EverliveApp app, String username, String password)
{
    User user = new User();
    user.setUsername(username);
    UserSecretInfo secretInfo = new UserSecretInfo();
    secretInfo.setPassword(password);
    return app.workWith().users().create(user, secretInfo).executeSync();
}

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 special object for secret information such as Password, Secret question, and Secret answer allows you to leverage the User class also to get users from Telerik Platform (secret information is not returned from the server anyway).

Register with 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.

Secret Question and Answer

Users regularly forget their password. To allow them to recover their account, you can apply 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:

 public RequestResult registerUserWithSecretQuestionAndAnswer(EverliveApp app, String username, String password, Object secretQuestionId, String secretAnswer)
{
    User user = new User(); // or your custom user class that extends User
    user.setUsername(username);
    UserSecretInfo secretInfo = new UserSecretInfo();
    secretInfo.setPassword(password);
    secretInfo.setSecretQuestion(secretQuestionId);
    secretInfo.setSecretAnswer(secretAnswer);

    return app.workWith().users().create(user, secretInfo).executeSync();
}

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.