How do I obtain the APNs certificates needed for iOS Push Notifications?

 

1. First, you need to obtain a .p12 certificate from the Apple Developer portal

 

We recommend you follow these comprehensive instructions to generate a .p12 certificate and save that .p12 file to a location on your local machine.  

 

Please note that the app ID you specify when registering your App ID must match the common name for the certificate signing request you generate.

 

2. Next, you can either import the .p12 certificate, or create a PEM file and copy this into your dashboard.

 

2a. Import the .p12 file

 

Visit your Notifications app dashboard

 

Then scroll down to the "Setting up Apple Push Notification Service" section.

 

Select the .p12 file you have exported in the previous step and enter the password you created when exporting the .p12 file.

 

Click "Save APNs settings" and you should get confirmation of the certificate being imported successfully.  You can additionally confirm that the file has been imported correctly by refreshing the page and seeing if the PEM cert and private key text boxes are now populated with the imported key details.

 

2b. Create a PEM file from the .p12 file

 

Using openssl, convert the recently exported .p12 file (io.ably.text.p12 in this instance) to a PEM file:

 

$ openssl pkcs12 -in ./io.ably.test.p12 -out ./io.ably.test.pem -nodes -clcerts

Then open the PEM file in your text editor and copy everything between and including -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- into the "Pem cert" text box of the Apple Push Notification Service section of your Notifications app dashboard.

 

Then copy everything between and including -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- into the "Pem private key" text box of the Apple Notification Section of your Notifications app dashboard.  

 

Press the "Save APNS settings" button to save your changes.