src/core.js
function (error_msg) {
    var self = this;
    return function (err, resp) {
      self._lock_refresh = undefined;
      if (!err) {
        var auth = JSON.parse(resp);
        if (!auth.error) {
          setToken.call(self, auth);
          return emit.call(self, 'auth.refresh', token.call(self));
        }
        return emit.call(self, 'auth.fail', error_msg + ': ' + JSON.stringify(auth.error));
      }
      return emit.call(self, 'auth.fail', error_msg + ': ' + JSON.stringify(err));
    };
  }
function (error_msg) {
    var self = this;
    return function (err, resp) {
      self._lock_refresh = undefined;
      if (!err) {
        var auth = JSON.parse(resp);
        if (!auth.error) {
          setToken.call(self, auth);
          return emit.call(self, 'auth.refresh', token.call(self));
        }
        return emit.call(self, 'auth.fail', error_msg + ': ' + JSON.stringify(auth.error));
      }
      return emit.call(self, 'auth.fail', error_msg + ': ' + JSON.stringify(err));
    };
  }
function ( error_msg ) { var self = this ; return function ( err , resp ) { self . _lock_refresh = undefined ; if ( ! err ) { var auth = JSON . parse ( resp ) ; if ( ! auth . error ) { setToken . call ( self , auth ) ; return emit . call ( self , 'auth.refresh' , token . call ( self ) ) ; } return emit . call ( self , 'auth.fail' , error_msg + ': ' + JSON . stringify ( auth . error ) ) ; } return emit . call ( self , 'auth.fail' , error_msg + ': ' + JSON . stringify ( err ) ) ; } ; }
Private helper function for registering a new token.
@param {string} error_msg
Private helper function for registering a new token .