112

With the recent up gradation of the Apple developer accounts, I am facing a difficulty that while trying to create the push notification certificates, it is providing me with (.p8) certificate instead of APNs ones which can be exported to (.p12).

Firebase console only accepts (.p12) certificates so how I can get that out from these new (.p8) certificates.

4
  • 2
    Where you get the .p8 certificate? I can still create the .p12 from my KeyChain.
    – Ragul
    Sep 24, 2016 at 5:16
  • I updated my license of apple account 2 days back and it is giving me .p8 certificates instead of p12 directly without even asking for the CSR file
    – Subso
    Sep 24, 2016 at 14:31
  • can you get solution ?? Sep 26, 2016 at 10:44
  • @DhavalBhadania I posted my answer below
    – Subso
    Oct 24, 2016 at 4:39

8 Answers 8

72

I was able to do this by selecting "All" located under the "Keys" header from the left column

enter image description here

Then I clicked the plus button in the top right corner to add a new key

enter image description here

Enter a name for your key and check "APNs"

enter image description here

Then scroll down and select Continue. You will then be brought to a screen presenting you with the option to download your .p8 now or later. In my case, I was presented with a warning that it could only be downloaded once so keep the file safe.

5
  • 6
    Thanks, the developer account has updated. There is no more APNs Auth Keys into Certificates
    – Djiggy
    Jul 6, 2017 at 9:28
  • Thanks, you saved me!
    – sioesi
    Mar 23, 2018 at 5:45
  • @John can you help me out, I've been stuck for the past few days. I can't get fcm working.. stackoverflow.com/questions/50292269
    – bibscy
    May 13, 2018 at 22:21
  • They key may not expire, but "provisioning profiles" do. Are they still required to send push notifications, or can we get rid of them safely? Thanks
    – andreszs
    Jun 11, 2018 at 22:16
  • 6
    @John Idasetima I'm confused how this answer the question - which was Firebase only accepts p12 but the new key is p8. Your answer just says how to download the key as a p8. Are you saying Firebase accepts the p8 as well as the p12?
    – Gruntcakes
    Jul 11, 2019 at 21:47
32

Apple have recently made new changes in APNs and now apple insist us to use "Token Based Authentication" instead of the traditional ways which we are using for push notification.

So does not need to worry about their expiration and this p8 certificates are for both development and production so again no need to generate 2 separate certificate for each mode.

To generate p8 just go to your developer account and select this option "Apple Push Notification Authentication Key (Sandbox & Production)"

enter image description here

Then will generate directly p8 file.

I hope this will solve your issue.

Read this new APNs changes from apple: https://developer.apple.com/videos/play/wwdc2016/724/

Also you can read this: https://developer.apple.com/library/prerelease/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html

12
  • 2
    Can we convert .p8 to .PEM type? Sep 28, 2016 at 14:08
  • Any platform which required .p8 does not need .PEM file, if it is still required then you need to make it separate Sep 28, 2016 at 18:11
  • 2
    I think Firebase does not yet support the use of APNs Auth Keys (.p8). But at the same time, it is easier to just do it from your own server now. Oct 20, 2016 at 23:33
  • 2
    Thanks - I'm not using firebase, but I found this answer most helpful for moving from .pem to .p8 files. I also found this step-by-step guide from Apple to be invaluable; it was the next step for me after following your answer : eladnava.com/…
    – kris
    Oct 21, 2016 at 8:14
  • 5
    @HardikShah This option "Apple Push Notification Authentication Key (Sandbox & Production)" is not available. why? Jun 19, 2017 at 10:07
27

May 2021 - Generating .p8 file instead of .cer file

The issue that I had was I couldn't find the way to create the .p8 file and all methods gave me .cer file instead.

  1. Head to your Apple developer account
  2. Go to the keys section and click on the plus button (or click here):

⚠️ It is very important to select the keys section and NOT the certificate or identifiers. otherwise you will get the .cer file at last 🤷🏻‍♂️

Keys section

  1. Select the Apple push notification service: Options

⚠️ Note that since it is very powerful certificate, it is very limited and you can not have much of these. So if you already created one, you will face something like this image and you should use that file or just revoke the old one.

  1. Download the.p8 file and secure it somewhere.
1
  • 1
    This is it, thanks!! The answer, after 2 hours of trying to convert .cer to .pem or .p12 and to .p8, was pretty simple.
    – matsbauer
    Aug 6, 2021 at 7:38
21

So, After taking a while I figured out that the old push certificate generating service also exists.

You get two options:

  • Apple Push Notification Authentication Key (Sandbox & Production)
  • Apple Push Notification service SSL (Sandbox & Production)

Those who want to achieve the old style .p12 certificate can get it from second option. I have not used the first option yet as most of the third-party push notification service providers still need the .p12 format certificate.

Sample image of the push notification service

6
  • 2
    This option "Apple Push Notification Authentication Key (Sandbox & Production)" is not available. Why ? Jun 19, 2017 at 10:12
  • 3
    I am also not able to find this option in the Developer.apple.com, is it any another way to create this p8 file? or to convert a p12 to P8? Jun 19, 2017 at 10:48
  • @ParthMehta Did you get any solution for this? Jun 20, 2017 at 10:55
  • 2
    Same here. I do not see Apple Push Notification Authentication Key option
    – ckim16
    Jun 21, 2017 at 23:23
  • 1
    Same, the ` Authentication Key` option is not available for me :( Apr 10, 2019 at 9:57
19

Firebase console is now accepting .p8 file, in fact, it's recommending to upload .p8 file.

You can see in below-attached screenshot

4
  • 3
    Please correct me if wrong, but that App ID prefix is actually the Team ID found at the Membership Information page, right? Because the tooltip clearly says it's located at the Membership Information page, and it even links to it.
    – andreszs
    Jun 11, 2018 at 22:34
  • 2
    What is the "Key ID" referenced there? Consider me a noob. May 21, 2019 at 15:51
  • 2
    @UmairAhmed The string of the device token you receive when you ask to register for push notifications. Jun 7, 2019 at 17:43
  • 2
    No. It's not the device token. It's the string after the underscore in the name of the .p8 file. Like this ---> AuthKey_A5HG8NYIFC.p8. Also you can see it after creating the key in the Key menu in Certificates, Identifiers & Profiles section in Apple Developer Website. Sep 11, 2019 at 14:57
9

Follow these steps:

1. Generate an APNs Auth Key
Open the APNs Auth Key page in your Developer Center and click the + button to create a new APNs Auth Key.

enter image description here

In the next page, select Apple Push Notification Authentication Key (Sandbox & Production) and click Continue at the bottom of the page.

enter image description here

Apple will then generate a .p8 key file containing your APNs Auth Key.

enter image description here

Download the .p8 key file to your computer and save it for later. Also, be sure to write down the Key ID somewhere, as you'll need it later when connecting to APNs.

2. Send Push Notifications

Ref: APNS (Configure push notifications)

Important: Save a back up of your key in a secure place. It will not be presented again and cannot be retrieved later.

7
  • 4
    APN's Auth Key does not exist in my developer portal. Does anyone know why?
    – ckim16
    Jun 21, 2017 at 23:24
  • @ckim16 - It can be generated once and won't be visible (removes APNS Auth key options) again. Here is reference to your query (help.apple.com/xcode/mac/current/#/…). If you have generated it previously, then it won't be visible to you again.
    – Krunal
    Jun 22, 2017 at 1:17
  • I wonder if your link only works for people who paid to have an Apple Developer account. For me, it redirects to developer.apple.com/account/#/welcome
    – Ryan
    Apr 15, 2018 at 19:22
  • @Krunal I've been stuck for the past few days trying to connect to firebase cloud messaging using the .p8 file and I can't get it to work. Could please have a look at my questions stackoverflow.com/questions/50292269
    – bibscy
    May 13, 2018 at 22:25
  • It doesn't download a p8 file for me :-| Sep 22, 2018 at 16:35
6

You can create the .p8 file for it in https://developer.apple.com/account/

Then go to Certificates, Identifiers & Profiles > Keys > add

apple_key

Select Apple Push Notification service (APNs), put a Key Name (whatever).

Then click on "continue", after "register" and you get it and you can download it.

4

When you upload your p8 file in Firebase, in the box that reads App ID Prefix(required) , you should enter your team ID. You can get it from https://developer.apple.com/account/#/membership and copy/paste the Team ID as shown below.

enter image description here

1
  • 2
    Thank you, I was looking for that exactly. The label is clearly wrong in FCM console and no one has noticed that error, even a year after.
    – andreszs
    Jun 11, 2018 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.