I create app for automatic loading of screenshots and texts for various localizations of the application to the AppStore Connect (for our company use), everything works well. Authorization use JWT.
But I receive messages from my ASO department that an error occurs with some unspecified frequency:
[401]NOT_AUTHORIZED: Authentication credentials are missing or invalid.
I couldn't reproduce the problem myself. Can someone suggest what could be the problem?
Hey @Ashcheulov,
Would it be possible for you to share additional information on where you are getting this error or how it is being reported?
The error above that you have posted is a very small subset of information that the App Store Connect API returns when you get a 401 from the server so having the additional details would be especially helpful.
However, without having this information, I would look in the below places.
-
Most of the time, the response headers from Apple will have a clue as to why your request was rejected. You could have exceeded the number of requests for the API key, you could be passing malformed data, etc. I would make sure to look through these as a starting place just to see what exists to help you in your efforts.
-
Is it possible that you are making a request that the API Key does not have permission for? Without knowing what API you are hitting and the exact response it is hard to tell, but if you are hitting the same API endpoint over and over and you get this randomly, it is possible the token expired prior to the remote server getting the request and reading the response error body should give you a clue on next steps.
-
It could be possible that the authorization header is missing all together. It is not likely if you are running a sequence of API requests and all of a sudden this stops working, but if you can run the commands verbose and view the API trace data this would be an area you could at least rule out.
Hopefully this helps you get started looking. My initial thought is that the token is expiring during the series of transactions possibly due to the overall number of screenshots you are uploading, but that is a guess without much factual information.
Happy coding!