I'm trying to create a test notification, but getting Unauthorized from the API. I've created an In-App Purchase key, and using the following code to generate the JWT Token:
from datetime import datetime, timedelta
from time import time, mktime
import jwt
dt = datetime.now() + timedelta(minutes=19)
headers = {
"alg": "ES256",
"kid": "B7J<..>",
"typ": "JWT",
}
payload = {
"iss": "acaf4d66-ea<..>",
"iat": int(time()),
"exp": int(mktime(dt.timetuple())),
"aud": "appstoreconnect-v1",
"bid": "com.w<..>"
}
with open("SubscriptionKey_B7J<..>.p8", "rb") as fh:
signing_key = fh.read()
gen_jwt = jwt.encode(payload, signing_key, algorithm="ES256", headers=headers)
print(f"{gen_jwt}")
One of the request IDs that failed: FPJYAOSUZTFXXIKUELW6QE7F54.0.0