index.js
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']);
  }
}
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']);
  }
}
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' ] ) ; } }
Handle cookies required for iCloud services to function
after authentication.
@param {Object} res
Handle cookies required for iCloud services to function after authentication .