The Telerik Platform product is retired.Learn more

How to Determine the User Account Making the Request in Business Logic


Service Business Logic
Feature Cloud Code for Data, Cloud Functions


Often you may need to check the user account properties of the current user making a request to a content type or a Cloud Function.


You can get information about the account but only if the request is made by an authenticated user as opposed to an anonymous user. To do so, check for the information contained in the object of the request parameter.


if (request.principal.type === 'user') {
    var currentUserObject =;
    console.log("The current user username is: " + currentUserObject.Username);
} else if (request.principal.type === 'anonymous') {
    console.log("The current request is made anonymously. No data for the current user.");
} else {
    console.log("The current request is made from the Telerik Platform UI");

See Also

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.