-
Notifications
You must be signed in to change notification settings - Fork 249
fix: Test transaction may also return 401 when queried in the production environment #315
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
base: master
Are you sure you want to change the base?
Conversation
@BB-5XGames , I think the |
I tried using this interface directly, but it couldn't query the sandbox again in the case of a 401 |
First of all. Per doc, the 401 Unauthorized
It means the jws token you provided is not valid. I think the jws token of your sandbox environment and production environment are different, am I right? If so, I think the better solution to solve it is that try the sandbox environment validation when the error is not nil . The codes like below. func (c *APIClient) Verify(ctx context.Context, transactionId string) (*TransactionInfoResponse, error) {
result, err := c.productionCli.GetTransactionInfo(ctx, transactionId)
if err != nil {
result, err = c.sandboxCli.GetTransactionInfo(ctx, transactionId)
}
return result, err
} Please correct me if anything missing. @BB-5XGames |
…e order in the production environment
I think the JWT used in the test and production environments should be the same, both generated by the code here, right? authToken, err := a.Token.GenerateIfExpired() This is indeed my temporary solution for now func (c *APIClient) Verify(ctx context.Context, transactionId string) (*TransactionInfoResponse, error) {
result, err := c.productionCli.GetTransactionInfo(ctx, transactionId)
if err != nil {
result, err = c.sandboxCli.GetTransactionInfo(ctx, transactionId)
}
return result, err
} |
Yes, the jwt token is same both in test and production environment. However, please make sure the those values of
following this doc https://developer.apple.com/documentation/appstoreserverapi/creating-api-keys-to-authorize-api-requests. Since the return code is 401, it means some of above parameters are not correct. You may double check them. @BB-5XGames |
No description provided.