Sometimes AppStoreConnect API return 401 error with this json:
{ "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" }] }
I think it occurred during an API request when the time is close to expiration.
decodedBearer.expiryDate.compare(Date()) != ComparisonResult.orderedDescending
Maybe change this compare logic and create new token a little earlier? (ex. expiryDate - 5sec)
Hi! Thanks for this SDK.
Sometimes AppStoreConnect API return 401 error with this json:
{ "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" }] }
I think it occurred during an API request when the time is close to expiration.
decodedBearer.expiryDate.compare(Date()) != ComparisonResult.orderedDescending
Maybe change this compare logic and create new token a little earlier? (ex.expiryDate - 5sec
)