apple / app-store-server-library-python

MIT License
146 stars 31 forks source link

`AppTransaction.appAppleId` is `None `when requesting `get_notification_history` and that makes verify_and_decode_app_transaction failed with `VerificationException: Verification failed with status INVALID_APP_IDENTIFIER` #47

Closed elonzh closed 9 months ago

elonzh commented 9 months ago

image

...
  File "/home/elonzh/.cache/pypoetry/virtualenvs/unob-hX3-r8Vo-py3.10/lib/python3.10/site-packages/appstoreserverlibrary/signed_data_verifier.py", line 110, in verify_and_decode_app_transaction
    raise VerificationException(VerificationStatus.INVALID_APP_IDENTIFIER)
          │                     └ <enum 'VerificationStatus'>
          └ <class 'appstoreserverlibrary.signed_data_verifier.VerificationException'>
appstoreserverlibrary.signed_data_verifier.VerificationException: Verification failed with status INVALID_APP_IDENTIFIER
alexanderjordanbaker commented 9 months ago

Those aren’t app transactions, those are signed notifications

elonzh commented 9 months ago

Those aren’t app transactions, those are signed notifications

Are your sure? Check the code please!

alexanderjordanbaker commented 9 months ago

You need to use verify_and_decode_signed_transaction not verify_and_decode_app_transaction

elonzh commented 9 months ago

@alexanderjordanbaker It works, thanks!

alexanderjordanbaker commented 9 months ago

AppTransaction is https://developer.apple.com/documentation/storekit/apptransaction JWSTransaction https://developer.apple.com/documentation/appstoreservernotifications/jwstransaction

https://developer.apple.com/documentation/appstoreservernotifications/data has details on the meaning of the fields in the notification

elonzh commented 9 months ago

Currently, the decoding method is somewhat inconvenient, and I hope a more intuitive method can be provided. For example, providing a cached_property for each encrypted field.