lib/Auth.js
function (options) {
  if (arguments.length < 1 || !options.appKey || !options.appSecret) {
    throw paramError;
  }
  if (!options.private) {
    if (!options.callbackUrl) {
      throw paramError;
    }
    options.scope || (options.scope = ['read_basic']);
  }

  this.app_key = options.appKey || '';
  this.app_secret = options.appSecret || '';
  this.private = options.private || false;
  this.callback_url = options.callbackUrl || '';
  this.scope = options.scope || '';
  this.redirect_url = options.redirectUrl || '';
  this.protocol = options.protocol || config.httpProtocol;
  this.host = options.host || config.appHost;
  this._request = new Request({
    protocol: this.protocol,
  });
}
function (options) {
  if (arguments.length < 1 || !options.appKey || !options.appSecret) {
    throw paramError;
  }
  if (!options.private) {
    if (!options.callbackUrl) {
      throw paramError;
    }
    options.scope || (options.scope = ['read_basic']);
  }

  this.app_key = options.appKey || '';
  this.app_secret = options.appSecret || '';
  this.private = options.private || false;
  this.callback_url = options.callbackUrl || '';
  this.scope = options.scope || '';
  this.redirect_url = options.redirectUrl || '';
  this.protocol = options.protocol || config.httpProtocol;
  this.host = options.host || config.appHost;
  this._request = new Request({
    protocol: this.protocol,
  });
}
构造函数
@param {Object} options
@param {string} options.appKey 应用的appKey
@param {string} options.appSecret 应用的appSecret
@param {string} options.callbackUrl 用于开放应用，应用管理后台设置的回调地址
@param {string} options.redirectUrl 用于开放应用，可选，自定义回调地址，默认同 callbackUrl
@param {Array} options.scope 用scope 于开放应用，可选，权限范围，默认为 ['read_basic']
@param {Boolean} options.private  可选，是否为私有应用，默认为 false
@param {string} options.protocol 可选，'http'或者'https',默认'https'
@param {string} options.host 可选，开发 API 接口域名,默认'api.youhaosuda.com'
@constructor