django-push-notifications
django-push-notifications copied to clipboard
New Apple .p8 apns cert support?
Is it possible to add support for apples .p8 apns format? I've tried using it through fcm but received a InvalidApnsCredential error.
They're much easier to work with than .pem
This might be something that needs to be done in pyapns2
I'm also having this issue. The current instructions linked refer to a p12 file and Apple doesn't give out p12 files anymore. https://github.com/jazzband/django-push-notifications/blob/master/docs/APNS.rst
I'm really not sure how I'm supposed to continue from this point
Okay, so I figured out how to get a p12 file and boy let me tell you. There's no way I could've figured this out by myself.
I managed to find this lovely website: https://batch.com/doc/ios/advanced/general.html#_generating-the-p12-certificate
The screenshots are a bit old but the information is still valid.
Here's a quick instruction list for those interested:
- Open Keychain Access
- Select "Certificates" from the Category Sidebar (not "My Certificates")
- Select the "Apple Worldwide Developer Relations Certification Authority" certificate from the list on the right.
- Select the Menu "Keychain Access" from the top Menu bar.
- From that Menu go into the "Certificate Assistant" Sub Menu.
- Select "Request a Certificate from a Certificate Authority"
- Select the "Save to Disk" and fill in the Information. Continue until complete.
- Go to the Identifiers List page and Select your App (or create one)
- Scroll down to Push Notifications section and select "Configure" or "Edit"
- Upload your Signing Certificate that you just created.
- Continue along the process and download your "cert" file.
- Open your new Cert file and add it to your Keychain Access
- Select your Cert file from Keychain Access. You should be able to find it under "My Certificates"
- Right click the Cert file and Select Export "Apple Push Services: ..."
- Give it a password (remember this for later) and Press okay.
- You have your p12 file! Now you can follow these instructions
Hopefully this helps someone stuck in the same situation.
If I would like to add the p8 support to the lib, where is the best way to start?
Okay, so p8 seems to be supported now. The support was silently added in release 2.0.0 (I found it just looking at the sources).
To use p8 you need to set your settings something like this:
PUSH_NOTIFICATIONS_SETTINGS = {
# "APNS_CERTIFICATE": - this seems to be NO longer needed, comment it out
"APNS_AUTH_KEY_PATH": os.path.join(BASE_DIR, "your_cert.p8"),
"APNS_AUTH_KEY_ID": "YOUR_AUTH_KEY",
"APNS_TEAM_ID": "YOUR_TEAM_ID",
"APNS_TOPIC": "YOUR_TOPIC", # usually same as device bundle name
"APNS_USE_SANDBOX": True, #or false
#"UPDATE_ON_DUPLICATE_REG_ID": True,
}
Would be awesome to add it to readme :)
I've followed these instructions and it connects and immediately closes. Not sure how to debug this.
@ianlater : FYI mine also connected and immediately closed when using the CLI verification. But it did work just fine.