bennord / appstore-tools

Tools for interacting with the AppStore Connect api
MIT License
1 stars 1 forks source link

Credentials expired while uploading #5

Closed luke14free closed 3 years ago

luke14free commented 3 years ago

I have an app localized in all locales, and thus it takes a long time to update (also connected to issue #3 ). Therefore at a certain point I got:

      myassets/xxxx/ro/screenshots/APP_IPHONE_55/2.jpg - uploading chunk (offset: 0, length: 223119)
      2.jpg - commiting upload
https://api.appstoreconnect.apple.com/v1/appScreenshots/... PATCH (HttpError 401)
{
  "request": {
    "data": {
      "id": "yyy",
      "attributes": {
        "uploaded": true,
        "sourceFileChecksum": "62241a33e90418241cc4875e7de854de"
      },
      "type": "appScreenshots"
    }
  },
  "response": {
    "errors": [
      {
        "status": "401",
        "code": "NOT_AUTHORIZED",
        "title": "Authentication credentials are missing or invalid.",
        "detail": "Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens"
      }
    ]
  }
}

Which I believe is because auth expired halfway through uploading

bennord commented 3 years ago

Ah, yes, that might be what's happening. We'd need to add some logic to check expiration/refresh the auth token for long running actions that have multiple appstore api calls.