code: function setConfig (conf,getPIN,next) {
      // check the token
      config = clone(conf);
      if (!conf.client_id || typeof conf.client_id != 'string') {
          next(new Error ('Trakter: No client ID in configuration'));
          return;
      }
      if (!conf.client_secret || typeof conf.client_secret != 'string') {
          next(new Error ('Trakter: No client secret in configuration'));
          return;
      }
      // set defaults
      config.redirect_uri= config.redirect_uri || "urn:ietf:wg:oauth:2.0:oob";
      config.state = config.state || "aufhof9qw12nsdv42";
      
  
      config.options = config.options || {};
      config.options.host = config.options.host || 'api-v2launch.trakt.tv';
      config.options.port = config.options.port || 443;
  
      config.options.headers = config.options.headers || {};
      config.options.headers['Content-type'] = config.options.headers['Content-type'] || 'application/json';
      config.options.headers['trakt-api-version'] = config.options.headers['trakt-api-version'] || 2;
      config.options.headers['trakt-api-key'] = config.client_id;
  
      if (!config.token) {
          if (!getPIN || typeof getPIN != 'function') {
              var e = new Error ('Trakter: setConfig - missing getPIN function');
              e.name = 'TrakterGetPIN';
              e.code = 98;
              next (e);
              return;
          }
          if (!conf.pinUrl || typeof conf.pinUrl != 'string') {
              next(new Error ('Trakter: No URL for PIN in configuration'));
              return;
          }
          exchangePIN(getPIN(conf.pinUrl),next);
      } else {
          next();
      }
  }
docs: Public 
  @method setConfig
  @param {Object} config A config object
  @param {Function} getPIN A function which returns a valid PIN
  @param {Function} next(err)
  @example
  trakter.setConfig( {config,getPIN,next)