.p8 file is an authentication key, not a certificate that you can convert into a .p12. In Firebase project settings, open Cloud Messaging and upload the key under APNs Authentication Key, along with its Key ID and your Apple Developer Team ID.Why this happens
Apple offers two ways for a push notification provider to authenticate with Apple Push Notification service (APNs): a token-based authentication key and a certificate. A .p8 file contains the private key for token-based authentication. A .p12 file can contain a certificate and its associated private key.
These are different credentials, not two file formats for the same credential. Renaming a .p8 file or exporting it as .p12 will not turn it into an APNs certificate. The Firebase console has a separate upload option for an APNs authentication key, so you normally do not need a .p12 file when you already have a suitable .p8 key.
The source question describes a Firebase console that accepted only certificates. Console layouts and features can change, so first check the current Cloud Messaging settings rather than assuming that the certificate upload field also accepts a key.
How to fix it
1. Upload the existing .p8 key to Firebase
If you already have an APNs authentication key, use Firebase’s key upload option rather than the certificate option.
- Open your project in the Firebase console.
- Open Project settings, then select Cloud Messaging.
- Find your Apple app configuration and the APNs Authentication Key section.
- Upload the
.p8file. Enter the key’s Key ID and your Apple Developer Team ID when prompted, then save the configuration. - Confirm that you are configuring the Firebase project and Apple app used by your iOS app.
The Key ID identifies the key in your Apple Developer account. The Team ID identifies the Apple Developer team that owns it. You can find the Key ID in the key’s details in the Apple Developer portal and the Team ID in your account’s membership information.
Keep the .p8 file private. It is a credential for sending push notifications through APNs, so do not commit it to a repository or share it in a support ticket. Store it in a secure location accessible only to people or systems that need it.
If you cannot find the authentication-key section, check that you are in the correct Firebase project and have opened the Cloud Messaging settings for an Apple app. Do not put the .p8 file into a field labeled for an APNs certificate.
2. Create an APNs key if you do not have one
Create the key in the Keys section of the Apple Developer portal. Starting in Certificates creates a different kind of credential.
- Sign in to your Apple Developer account and open Certificates, Identifiers & Profiles.
- Select Keys, then use the add button to register a new key.
- Give the key a recognizable name and enable Apple Push Notifications service (APNs).
- Continue through the registration screens and download the
.p8file. - Record the Key ID and store the downloaded file securely. Then upload the key to Firebase as described above.
Treat the download as your opportunity to retain the private key: Apple presents a download warning when creating a key. Do not assume you can retrieve the same private key from the portal later. If your team already has a suitable APNs key, check whether it is available in your team’s secure storage before creating another one.
Do not revoke an existing key just to make room without checking its users first. Revoking it can interrupt other services that rely on it. If the original file is unavailable, coordinate a replacement and update every service that uses the old key before revoking it.
3. Use a certificate only if your setup requires .p12
If you specifically need certificate-based authentication, create an APNs certificate separately; there is no conversion from the .p8 key. The certificate process uses a certificate signing request and its associated private key.
- In the Apple Developer portal, go to Certificates and create an APNs certificate for the appropriate app identifier. Follow the portal’s instructions for the certificate signing request.
- Install the issued certificate on the Mac that has the private key associated with that request.
- In Keychain Access, locate the certificate and its associated private key. Export them together as a
.p12file, protecting the export with a password. - Upload that
.p12file through Firebase’s APNs certificate option, supplying the password if requested.
A downloaded .cer certificate by itself is not the same as a .p12 containing both the certificate and its private key. If Keychain Access cannot find the matching private key, exporting the certificate alone will not provide Firebase with the complete certificate credential it needs.
For a new Firebase configuration, the authentication-key route is generally simpler if your team can use it: keep the .p8, Key ID, and Team ID together in your credential inventory, without trying to create a certificate from the key.
4. Check the app configuration if pushes still do not arrive
Uploading an APNs credential configures Firebase’s connection to APNs; it does not by itself complete the iOS app’s push notification setup.
- Check that the bundle identifier in the Apple Developer app identifier matches the app you registered with Firebase.
- In Xcode, verify that the app target has the Push Notifications capability and that its signing configuration supports that capability.
- Make sure the app registers for remote notifications and that the Firebase configuration belongs to the project where you uploaded the APNs credential.
- Test on a device with a build that has the appropriate signing and provisioning setup. A successful credential upload does not guarantee that notification permission, device registration, and message delivery are all working.
If another service also uses the APNs key, check its configuration before replacing or revoking the key. Firebase and that service may need to be updated separately.
How to prevent it
- Label APNs authentication keys and certificates clearly so your team knows which credential each service uses.
- Record the Key ID and Team ID alongside the securely stored
.p8file. - Never commit
.p8or.p12files to source control. - Document which services use each key before rotating or revoking it.
- Use the Firebase upload field that matches the credential type.
FAQ
Can I convert an APNs .p8 file to .p12?
No. An APNs .p8 authentication key is not an APNs certificate. If you need a certificate-based .p12, create an APNs certificate and export it with its matching private key.
Where do I find the Key ID and Team ID?
Find the Key ID in the key’s details under Keys in the Apple Developer portal. Your Team ID is available in your Apple Developer account’s membership information.
Do I need a separate APNs certificate after uploading a .p8 key?
Not just to authenticate Firebase with APNs: the authentication key is an alternative to certificate-based authentication. You still need to configure push notifications, signing, and device registration in your app.
Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.
