apple / app-store-server-library-python

MIT License
147 stars 31 forks source link

Getting Authentication Error #57

Closed malikmajai closed 7 months ago

malikmajai commented 7 months ago

Hi, I am getting 401 error. I have tried both APIs information from App Store Connect API and In-App Purchase. Both didn't worked for me. I got key id, issuer id and bundle id correctly. Not sure if I am loading p8 file correctly having Developer Permissions. Check this out:

def read_private_key(file_path):
    with open(file_path, "rb") as key_file:
        signing_key = key_file.read()
    return signing_key

The error I get is while verifying receipt data:

Traceback (most recent call last):
  File "d:\Bots\sandrastone763\test7.py", line 41, in <module>
    response = client.get_transaction_history(transaction_id, revision, request)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\appstoreserverlibrary\api_client.py", line 635, in get_transaction_history
    return self._make_request("/inApps/v1/history/" + transaction_id, "GET", queryParameters, None, HistoryResponse)
  File "C:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\appstoreserverlibrary\api_client.py", line 490, in _make_request
    raise APIException(response.status_code)
appstoreserverlibrary.api_client.APIException: 401
alexanderjordanbaker commented 7 months ago

The App Store Server API uses the key under In-App Purchase. Is this in the Sandbox environment?

malikmajai commented 7 months ago

In-App Purchase Key worked. Wasn't working on Windows while development but worked on Linux server.

tenghuil commented 4 months ago

In-App Purchase Key worked. Wasn't working on Windows while development but worked on Linux server.

Hi did you do anything before it worked on your Linux server? I'm facing the same problem and i'm testing on Ubuntu server, but always get 401