Generate a .p8 authentication key

Steps to generate a .p8 authentication key for token-based APNs push notification authentication.

This article describes how to generate a .p8 authentication key for token-based authentication with Apple Push Notification service (APNs). This is the recommended method for the Push adapter. Unlike the certificate-based .pem method, it does not require periodic renewal and works across both Sandbox and Production environments with a single key.

A remote server cannot directly push a notification to a user's device. To send notifications from a remote server, Apple requires the notification payload to be sent to APNs, which then delivers it to the targeted device. Token-based authentication uses a .p8 key, a Key ID, and a Team ID to securely sign these requests.

Create the authentication key

  1. Sign in to the Apple Developer Portal.
  2. Navigate to Certificates, Identifiers & Profiles.
  3. In the left pane, click Keys.
  4. Click the + button in the upper-right corner to register a new key.
  5. Provide a name for the key.
  6. Under Key Services, select Apple Push Notifications service (APNs), and click Continue.
  7. Review the details and click Register.
  8. Click Download to save the .p8 key file to your Mac.
🚧

Important

Apple allows the .p8 key file to be downloaded only once. Store it in a secure location immediately after downloading. If the file is lost, the key must be revoked and a new one generated.

Note the Key ID and Team ID

  • Key ID: Shown on the key's details page immediately after registration, and under Certificates, Identifiers & Profiles > Keys by selecting the key.
  • Team ID: Shown in the Membership details section of your Apple Developer account, under your account name.

Upload the .p8 key to our platform

Upload the .p8 key, Key ID, and Team ID to our platform to enable notifications for your customers. For upload steps, see Register your iOS app with Blueshift.


Did this page help you?