How to use Apple's new .p8 certificate for APNs in firebase console

136,466

Solution 1

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.

Solution 2

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

Solution 3

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

Solution 4

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

You can see in below-attached screenshot

Solution 5

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.
Share:
136,466

Related videos on Youtube

Subso
Author by

Subso

Updated on May 12, 2021

Comments

  • Subso
    Subso about 3 years

    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.

    • Ragul
      Ragul almost 8 years
      Where you get the .p8 certificate? I can still create the .p12 from my KeyChain.
    • Subso
      Subso almost 8 years
      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
    • Dhaval Bhadania
      Dhaval Bhadania almost 8 years
      can you get solution ??
    • Subso
      Subso over 7 years
      @DhavalBhadania I posted my answer below
  • Dimple Shah
    Dimple Shah over 7 years
    Can we convert .p8 to .PEM type?
  • Hardik Shah
    Hardik Shah over 7 years
    Any platform which required .p8 does not need .PEM file, if it is still required then you need to make it separate
  • Andre Cytryn
    Andre Cytryn over 7 years
    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.
  • kris
    kris over 7 years
    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/…
  • Balasubramanian
    Balasubramanian about 7 years
    @HardikShah This option "Apple Push Notification Authentication Key (Sandbox & Production)" is not available. why?
  • Balasubramanian
    Balasubramanian about 7 years
    This option "Apple Push Notification Authentication Key (Sandbox & Production)" is not available. Why ?
  • Parth Mehta
    Parth Mehta about 7 years
    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?
  • Balasubramanian
    Balasubramanian about 7 years
    @ParthMehta Did you get any solution for this?
  • ckim16
    ckim16 about 7 years
    Same here. I do not see Apple Push Notification Authentication Key option
  • ckim16
    ckim16 about 7 years
    APN's Auth Key does not exist in my developer portal. Does anyone know why?
  • Krunal
    Krunal about 7 years
    @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.
  • Djiggy
    Djiggy almost 7 years
    Thanks, the developer account has updated. There is no more APNs Auth Keys into Certificates
  • sioesi
    sioesi over 6 years
    Thanks, you saved me!
  • Ryan
    Ryan about 6 years
    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
  • bibscy
    bibscy about 6 years
    @HardikShah is there an option to delete previous Keys created in developer.apple.com? I only see a + button, but no - button , or delete..
  • bibscy
    bibscy about 6 years
    @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
    bibscy about 6 years
    @HardikShah any idea what I am doing wrong? I can't get fcm to work. Please red my question stackoverflow.com/questions/50292269
  • bibscy
    bibscy about 6 years
    @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
  • Hardik Shah
    Hardik Shah about 6 years
    @bibscy Have you tested to send push notification from the firebase console itself? What are you getting?
  • bibscy
    bibscy about 6 years
    @HardikShah I tried to send push notifications from firebase console itself and I get error Invalid APNs certificate. Check the certificate in settings. Once I download the p8 file from developer.apple.com, the only thing I did was to upload it in firebase console in box that reads APNs Authentication Key . Do I have to double click or do anything else with the p8 file on my Mac?
  • Hardik Shah
    Hardik Shah about 6 years
    @bibscy Steps in your questions seems perfectly fine. Just double check that the APP id and bundle ID is proper while adding p8. Actually, it is pretty straightforward process nothing fancy but if you getting trouble then I recommend you that please verify 2 things and if still not work then create a fresh test project and try to do that. Sometimes when we try hard nothing works so in that case it is better to fresh start.
  • andreszs
    andreszs about 6 years
    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
    andreszs about 6 years
    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
    andreszs about 6 years
    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.
  • Oliver Dixon
    Oliver Dixon almost 6 years
    It doesn't download a p8 file for me :-|
  • Axel Guilmin
    Axel Guilmin about 5 years
    Same, the ` Authentication Key` option is not available for me :(
  • Nick Turner
    Nick Turner about 5 years
    It complains unless you set the team id on the project settings first. For some reason google wants to read the TeamId for you
  • Umair Ahmed
    Umair Ahmed about 5 years
    What is the "Key ID" referenced there? Consider me a noob.
  • Huy-Anh Hoang
    Huy-Anh Hoang about 5 years
    @UmairAhmed The string of the device token you receive when you ask to register for push notifications.
  • Gruntcakes
    Gruntcakes almost 5 years
    @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?
  • Somoy Das Gupta
    Somoy Das Gupta almost 5 years
    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.
  • Anant
    Anant almost 5 years
    I know this question is not directly related but I am getting: Exception: TooManyProviderTokenUpdates after updating my certificates to .p8 [stackoverflow.com/questions/57911697/… I am using apns2 library. Can you answer my question?
  • Vyachaslav Gerchicov
    Vyachaslav Gerchicov over 4 years
    Double clicked - it is opened in text editor instead. How to return the default behaviour you described?
  • N S
    N S about 4 years
    This flow generates a .cer file not a .p8 file. Does the .cer need to be converted somehow?
  • eemrah
    eemrah about 3 years
    hey @Krunal, thanks for the answer, I've worked for make it work but when I get even documentation for FCM it did not work when I upload it p8 file (APNS Key). I had to upload a p12 file too like the old style. I cannot find the problem
  • matsbauer
    matsbauer almost 3 years
    This is it, thanks!! The answer, after 2 hours of trying to convert .cer to .pem or .p12 and to .p8, was pretty simple.