Fatal1ty / aioapns

An efficient APNs Client Library for Python/asyncio
Apache License 2.0
120 stars 52 forks source link

Apple Wallet Passes for different PassTypeID - i dont understand how to push #71

Open haladynkamil opened 1 month ago

haladynkamil commented 1 month ago

Hello, i have a webapp that is able to create apple wallet passes for iOS. Process more or less looks like this: User provides his Apple Pass ID and certificate from apple developer, based on that cert i am creating wallet passes that i can send to devices, then devices register to my webServiceURL.

Now i have tested this app while creating the passes from my Apple Pass ID and while using my APNs key from the same developer account and everything works great. What im looking for now is how to send push notifications to devices that have passes with different Apple Pass ID (so from user apple pass ID) with my APNs key.

Apps like PassKit etc. can send those notifications while not requesting user to provide his APNs key, maybe there is something i fundamentally dont understand about this process.

haladynkamil commented 1 month ago

I just fixed it, for people struggling with the same approach here is the solution:

What Apple requires in terms of passes is to validate yourself using certificate method, for APNs() client you should only use client_cert and use_sandbox=False, where for client_cert it should be a .pem file of COMBINED private key (used to generate CSR for apple) and PassTypeID certificate in ONE file. Do not put team_id or topic, it doesnt matter (they are in the cert anyway) and the push will work.

Fatal1ty commented 1 month ago

@haladynkamil I’m glad you solved the problem. Would you mind opening a PR with this useful information in the README?