function logInAppUser (username, password, successCallback, failureCallback) {
    var self = this;
    var data = {"username": username, "password": password, "grant_type": "password"};
    this.runAppQuery(new Usergrid.Query('POST', 'token', data, null,
      function (response) {
        var user = new Usergrid.Entity('users');
        user.set('username', response.user.username);
        user.set('name', response.user.name);
        user.set('email', response.user.email);
        user.set('uuid', response.user.uuid);
        self.setLoggedInUser(user);
        self.setToken(response.access_token);
        if (successCallback && typeof(successCallback) === "function") {
          successCallback(response);
        }
      },
      function (response) {
        if (failureCallback && typeof(failureCallback) === "function") {
          failureCallback(response);
        }
      }
     ));
  }
/*
  *  A public method to log in an app user - stores the token for later use
  *
  *  @method logInAppUser
  *  @public
  *  @params {string} username
  *  @params {string} password
  *  @params {function} successCallback
  *  @params {function} failureCallback
  *  @return {response} callback functions return API response object
  */
A public method to log in an app user - stores the token for later use


A public method to log in an app user - stores the token for later use
function logInAppUser (username, password, successCallback, failureCallback) {
    var self = this;
    var data = {"username": username, "password": password, "grant_type": "password"};
    this.runAppQuery(new Usergrid.Query('POST', 'token', data, null,
      function (response) {
        var user = new Usergrid.Entity('users');
        user.set('username', response.user.username);
        user.set('name', response.user.name);
        user.set('email', response.user.email);
        user.set('uuid', response.user.uuid);
        self.setLoggedInUser(user);
        self.setToken(response.access_token);
        if (successCallback && typeof(successCallback) === "function") {
          successCallback(response);
        }
      },
      function (response) {
        if (failureCallback && typeof(failureCallback) === "function") {
          failureCallback(response);
        }
      }
     ));
  }
function logInAppUser ( username , password , successCallback , failureCallback ) { var self = this ; var data = { "username" : username , "password" : password , "grant_type" : "password" } ; this . runAppQuery ( new Usergrid . Query ( 'POST' , 'token' , data , null , function ( response ) { var user = new Usergrid . Entity ( 'users' ) ; user . set ( 'username' , response . user . username ) ; user . set ( 'name' , response . user . name ) ; user . set ( 'email' , response . user . email ) ; user . set ( 'uuid' , response . user . uuid ) ; self . setLoggedInUser ( user ) ; self . setToken ( response . access_token ) ; if ( successCallback && typeof ( successCallback ) === "function" ) { successCallback ( response ) ; } } , function ( response ) { if ( failureCallback && typeof ( failureCallback ) === "function" ) { failureCallback ( response ) ; } } ) ) ; }
A public method to log in an app user - stores the token for later use
A public method to log in an app user - stores the token for later use