How to Create APNs Authentication Key?
This guide provides steps for generating an Authentication Key for your Firebase Cloud Messaging Service.
Step 1. Generate APNs Authentication Key
Apple Developer Member Center
To begin, visit the Apple Developer Member Center and log in with your credentials.
Click the Account button on the top right.
After that, click Keys from the Certificates, Identifiers & Profiles section, Mentioned in the screenshot below.
Next, click the Blue Plus (+) icon next to the Keys word mentioned in the screenshot below.
After clicking on that, you will be moving to a new page named Register a New Key. Enter the key name and choose the Apple Push Notifications Service (APNs) from the list available below. Below is a screenshot showing how to correctly state this information.
Then click on the Register button to generate a new key. After key generating is successful, you can see a button named Download appear there. Click on the Download button to download the generated key file (.p8) into your local storage.
Please note that you can download the auth key file only once.
Step 2. Upload generated Key file to Firebase
Firebase Console
First, log in to your Firebase console using this URL and open your previously created Firebase project for your app (If you haven't created your Firebase project yet, see this article for creating your Firebase project).
After you open your Firebase project, click on the settings icon (⚙) placed on top of the left side menu (You can see this button mentioned in the screenshot below). After you click on it, it will open your Project settings screen.
Next, click on the tab named Cloud Messaging for the next steps. Then scroll down until you see the Apple app configuration section. Now there is a title named APNs Authentication Key in the Apple apps section. (We have shown the facts mentioned here in the screenshot below)
The next step is to click on the Upload button under the APNs Authentication Key subheading mentioned in the photo above. After clicking on that button there will popup a dialog box with the Upload APNs auth key title. Click on the Browse button next to Drag file here to preview text and open the key file you have already downloaded in the above steps.
Then, move again to your Apple Developer Member Center and navigate to the Keys section by following the steps done earlier. Now you can see there was the key file you created above steps, click on it to navigate to view key details page. Copy the value under the Key ID text. This is mentioned in the screenshot below.
Now paste the copied value into the Key ID text field in the Firebase Upload APNs auth key popup.
For the next step, you have to move again your Apple Developer Member Center and click on the Membership details button mentioned in the screenshot below.
After clicking on that you will automatically scroll down into the Membership details section. Now you can see your Team ID in that section. copy that value and paste it into the Team ID text field in the Firebase Upload APNs auth key popup.
Finally, click on the Upload button in the dialog box to finish setting up your APNs Auth key.