Closed hakusai22 closed 2 months ago
public String generateToken() {
return JWT.create()
.withAudience(APP_STORE_CONNECT_AUDIENCE)
.withExpiresAt(Instant.now().plus(ChronoUnit.MINUTES.getDuration().multipliedBy(5)))
.withIssuer(issuerId)
.withKeyId(keyId)
.withPayload(Map.of(BUNDLE_ID_KEY, bundleId))
.sign(Algorithm.ECDSA256(signingKey));
}
I see that the code for generating tokens is one-time and newly generated. Why does 401 appear?
@alexanderjordanbaker hello ,If you have time, can you help me analyze this problem? Thank you. There have been a lot of 401 in the production environment recently.
Oh my god.
I've been experiencing this problem recently as well. And it's still happening today.
I was searching google over and over again and found the same problem here now.
I keep getting the 401 error from time to time. This seems like a bug from Apple.
Oh my god.
I've been experiencing this problem recently as well. And it's still happening today.
I was searching google over and over again and found the same problem here now.
I keep getting the 401 error from time to time. This seems like a bug from Apple.
Most requests are successful, but some requests result in 401?
@hakusai22 Let me take a look and get back to you
any update on this?
Oh my god. I've been experiencing this problem recently as well. And it's still happening today. I was searching google over and over again and found the same problem here now. I keep getting the 401 error from time to time. This seems like a bug from Apple.
Most requests are successful, but some requests result in 401?
Exactly, yes.
And, as a separate issue, API calls to Apple apps that are not yet set up in production also result in a 401 error. The 401 error shouldn't occur because the JWT is correct.
The official guidance from Apple says to try calling the Production API first and if the response is invalid, try calling the Sandbox API, but a 401 response doesn't seem appropriate.
@hakusai22 This should be improved now, please let me know if you continue to experience this issue
@hakusai22 This should be improved now, please let me know if you continue to experience this issue
This abnormal situation still appeared in the log today. My version is still 2.0.0
@hakusai22 This is after my post?
Wait that status code is 500?
Wait that status code is 500?
For my business, this is a 500 exception. The official API returns 401.
@hakusai22 This is after my post?
About an hour before you posted
@hakusai22 I checked the logs, you were 6 minutes before the change deployed. Please let me know if you see it again now that the change is out
@alexanderjordanbaker OK, I'll take a look. What's the reason?
When calling the getAllSubscriptionStatuses(String transactionId, Status[] status) method in a production environment, an exception occasionally occurs, httpStatusCode=401, apiError=null, apiErrorMessage='null'. All my configurations are unified. When I create the AppStoreServerAPIClient, this exception will occasionally occur. I don't understand the triggering scenario of this accidental exception.
https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses