lib/request.js
function encodeUserAuth(user) {
  if (!user) {
    return null;
  }

  var token = user.token;
  if (token) {
    var sha1 = typeof token === 'object' ? token.sha1 : token;
    return 'token ' + sha1;
  }

  return 'Basic ' + base64.encode(user.username + ':' + user.password)
}
function encodeUserAuth(user) {
  if (!user) {
    return null;
  }

  var token = user.token;
  if (token) {
    var sha1 = typeof token === 'object' ? token.sha1 : token;
    return 'token ' + sha1;
  }

  return 'Basic ' + base64.encode(user.username + ':' + user.password)
}
function encodeUserAuth ( user ) { if ( ! user ) { return null ; } var token = user . token ; if ( token ) { var sha1 = typeof token === 'object' ? token . sha1 : token ; return 'token ' + sha1 ; } return 'Basic ' + base64 . encode ( user . username + ':' + user . password ) }
Generates the authentication parameter for the user
Preference will be given to the token if it exists
@param user the use used for authentication. Requires token or username and password
@return {string|null} the properly formatted authentication string
Generates the authentication parameter for the user Preference will be given to the token if it exists