Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StatusCodeError: 412 #53

Open
doguh opened this issue Feb 3, 2021 · 9 comments
Open

StatusCodeError: 412 #53

doguh opened this issue Feb 3, 2021 · 9 comments

Comments

@doguh
Copy link

doguh commented Feb 3, 2021

Connecting to iTunes Connect now results in a 412 error.

    const i = new itc.Itunes(
      config.appstore.login,
      config.appstore.password,
      {
        errorCallback: reject,
        successCallback: () => resolve(i),
      }
    );

Will reject with StatusCodeError: 412 - {"authType":"sa"} error.

See the PR below for a possible fix:
#52

lancondrej added a commit to bizztreat/keboola-ex-itunes-analytics that referenced this issue Feb 4, 2021
 - unfortunately it's not fix in iteunesconnectanalytics lib yet but there is a an issue JanHalozan/iTunesConnectAnalytics#53 - with PR solving it so lets use that commit as dependency
@sann05
Copy link

sann05 commented Feb 8, 2021

@doguh you are my hero

@sann05
Copy link

sann05 commented Feb 15, 2021

It seems like it's not over yet:

var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;

var username = 'myname';
var password = 'mypass';
var appId = '12345'; //My apple id

var instance = new Itunes(username, password, {
  errorCallback: function(e) {
    console.log('Error logging in: ' + e);
  },
  successCallback: function(d) {
    console.log('Logged in');
  }
});
instance.getApps(function(error, data) {
  console.log(JSON.stringify(data, null, 2));
});

It returns:

Logged in
null

@sann05
Copy link

sann05 commented Feb 15, 2021

It seems like it's not over yet:

var itc = require('itunesconnectanalytics');
var Itunes = itc.Itunes;

var username = 'myname';
var password = 'mypass';
var appId = '12345'; //My apple id

var instance = new Itunes(username, password, {
  errorCallback: function(e) {
    console.log('Error logging in: ' + e);
  },
  successCallback: function(d) {
    console.log('Logged in');
  }
});
instance.getApps(function(error, data) {
  console.log(JSON.stringify(data, null, 2));
});

It returns:

Logged in
null

It turns out that itunes analytics API URL was changed to https://appstoreconnect.apple.com/analytics/api/v1

@doguh
Copy link
Author

doguh commented Feb 15, 2021

Good catch @sann05!

I'll update my pull request

@Reiszecke
Copy link

Reiszecke commented Aug 31, 2021

@doguh sorry for the @ but you seem to be the only active contributor at this point. Do you have some info on #43 ? My best guess is that we are using it wrong but cookies aren't explained anywhere in the readme.

What does your implementation look like, do you override .getCookies somewhere in your app? Whatever I try, the session only survives for about 6 hours .__.

@doguh
Copy link
Author

doguh commented Aug 31, 2021

@Reiszecke I'm not using 2FA so I don't know about this issue.

That being said, the session expiring after 6 hours seems normal to me, it can't last forever.

In my implementation I create a new ict.Itunes(login, password, callback) at the start of every job (a job being pulling app analytics data for our apps for example).
If your job lasts more than 6 hours, perhaps you'll need to create a new ict.Itunes object every 6 hours.

@Reiszecke
Copy link

How did you manage to make an account without 2FA tho? I would love to just do that tbh

@doguh
Copy link
Author

doguh commented Aug 31, 2021

@Reiszecke It's an relatively old account. I never activated 2FA on it. I don't think there is a way to disable it once it has been enabled :/

@Reiszecke
Copy link

Hey @doguh I found this fork which has it all apparently - #43 (comment)

Just letting you know you may want to fetch/merge some commits into your repo too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants