Reading User Accounts

Reading User Accounts

The read user account operation returns the user account object from the Users content type with the exception of sensitive fields such as Password.

Single User

To read a single user based on its Id, you have to execute the following code snippet:

var el = new Everlive('your-app-id');
el.Users.getById('item-id-here')
    .then(function (data) {
        alert(JSON.stringify(data));
    },
    function(error){
        alert(JSON.stringify(error));
    });

Current User

To get the data about the currently logged in user, call the currentUser() method.

var el = new Everlive('your-app-id');
el.Users.currentUser()
    .then(function (data) {
        alert(JSON.stringify(data));
    },
    function(error){
        alert(JSON.stringify(error));
    });

There are several possible outcomes of the call depending on whether the user has already been authenticated or not. You should handle each of them in your app.

Success

  • When the user is authenticated (in other words a valid access token is stored in the Everlive instance), the returned object contains all the information about the current user.

  • When there is no token sent with the request, the result has a null value.

Error

  • When the access token is invalid or the user is logged out, an error result is returned that contains the following message and error code: *
{ "message": "Invalid access token.", "errorCode": 301 }

Multiple Users

var el = new Everlive('your-app-id');
el.Users.get()
    .then(function(data){
        alert(JSON.stringify(data));
    },
    function(error){
        alert(JSON.stringify(error));
    });
Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.