How to use Apple's new .p8 certificate for APNs in firebase console
Solution 1
I was able to do this by selecting "All" located under the "Keys" header from the left column
Then I clicked the plus button in the top right corner to add a new key
Enter a name for your key and check "APNs"
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)"
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.
Solution 4
Firebase console is now accepting .p8 file, in fact, it's recommending to upload .p8 file.
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.
- Head to your Apple developer account
- 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 thecertificate
oridentifiers
. otherwise you will get the.cer
file at last 🤷🏻♂️
⚠️ 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.
- Download the
.p8
file and secure it somewhere.
Related videos on Youtube
Subso
Updated on May 12, 2021Comments
-
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 almost 8 yearsWhere you get the .p8 certificate? I can still create the .p12 from my KeyChain.
-
Subso almost 8 yearsI 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 almost 8 yearscan you get solution ??
-
Subso over 7 years@DhavalBhadania I posted my answer below
-
-
Dimple Shah over 7 yearsCan we convert .p8 to .PEM type?
-
Hardik Shah over 7 yearsAny platform which required .p8 does not need .PEM file, if it is still required then you need to make it separate
-
Andre Cytryn over 7 yearsI 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 over 7 yearsThanks - 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 about 7 years@HardikShah This option "Apple Push Notification Authentication Key (Sandbox & Production)" is not available. why?
-
Balasubramanian about 7 yearsThis option "Apple Push Notification Authentication Key (Sandbox & Production)" is not available. Why ?
-
Parth Mehta about 7 yearsI 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 about 7 years@ParthMehta Did you get any solution for this?
-
ckim16 about 7 yearsSame here. I do not see Apple Push Notification Authentication Key option
-
ckim16 about 7 yearsAPN's Auth Key does not exist in my developer portal. Does anyone know why?
-
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 almost 7 yearsThanks, the developer account has updated. There is no more
APNs Auth Keys
intoCertificates
-
sioesi over 6 yearsThanks, you saved me!
-
Ryan about 6 yearsI 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 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 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 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 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 about 6 years@bibscy Have you tested to send push notification from the firebase console itself? What are you getting?
-
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 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 about 6 yearsThey 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 about 6 yearsPlease 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 about 6 yearsThank 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 almost 6 yearsIt doesn't download a p8 file for me :-|
-
Axel Guilmin about 5 yearsSame, the ` Authentication Key` option is not available for me :(
-
Nick Turner about 5 yearsIt 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 about 5 yearsWhat is the "Key ID" referenced there? Consider me a noob.
-
Huy-Anh Hoang about 5 years@UmairAhmed The string of the device token you receive when you ask to register for push notifications.
-
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 almost 5 yearsNo. 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 almost 5 yearsI 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 over 4 yearsDouble clicked - it is opened in text editor instead. How to return the default behaviour you described?
-
N S about 4 yearsThis flow generates a .cer file not a .p8 file. Does the .cer need to be converted somehow?
-
eemrah about 3 yearshey @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 almost 3 yearsThis is it, thanks!! The answer, after 2 hours of trying to convert .cer to .pem or .p12 and to .p8, was pretty simple.