code: function(res) {
    function addCookie(cookie) {
      try {
        cookieJar.setCookieSync(cookie, config.base_url);
      } catch (err) {
        throw err;
      }
    }
  
    if (Array.isArray(res.headers['set-cookie'])) {
      res.headers['set-cookie'].forEach(addCookie);
    } else {
      addCookie(res.headers['set-cookie']);
    }
  }
docs: Handle cookies required for iCloud services to function
  after authentication.
  @param {Object} res