From 7e0d0267b606a93f4b3f5cbab56b37a0ea14785a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5nis=20Simo?= Date: Thu, 25 May 2017 15:32:10 +0300 Subject: [PATCH] Change session url to fetch itCtx value. Apple changed session url to https://olympus.itunes.apple.com/v1/session which sets the itctx value in cookies. Fix issue #16 --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 91861b0..f8bd76e 100644 --- a/index.js +++ b/index.js @@ -113,6 +113,7 @@ function Connect(username, password, options) { baseURL : "https://itunesconnect.apple.com", apiURL : "https://reportingitc2.apple.com/api/", loginURL : "https://idmsa.apple.com/appleauth/auth/signin", + sessionURL : "https://olympus.itunes.apple.com/v1/session", appleWidgetKey : "22d448248055bab0dc197c6271d738c3", concurrentRequests : 2, errorCallback : function(e) {}, @@ -297,7 +298,7 @@ Connect.prototype.login = function(username, password) { //Request itunes connect page that will give us itCtx cookie needed for api requests request.get({ //not sure where this action comes from, so it's hardcoded - url : self.options.baseURL + "/WebObjects/iTunesConnect.woa", + url : self.options.sessionURL, followRedirect : false, //We can't follow redirects, otherwise we will "miss" the itCtx cookie headers : { 'Cookie': myAccount[0] @@ -962,4 +963,4 @@ TransformValue.toMomentObject = function(date) { else { throw new Error('Unknown date format. Please use Date() object or String() with format YYYY-MM-DD.'); } -} \ No newline at end of file +}