iOS p8 Token-Based Connection

developer

iOS p8 Token-Based Connection to APNs

Step-by-step guide for creating an iOS .p8 Authentication Key for Apple Push Notification service (APNs).

To send push notifications to iOS apps, an authenticated connection to Apple Push Notification Services (APNs) is required. You can authenticate using a token-based (.p8 key) or a certificate-based (.p12 file) method — but only one is necessary.

This guide walks you through setting up a token-based .p8 key, the recommended approach.

Tip
.p8 keys do not expire, unlike .p12 certificates which must be renewed annually. This makes .p8 the recommended authentication method.

Requirements

Before starting, ensure you have:


Generate Your .p8 Key in Apple Developer Account

Step 1: Access Keys Section

  1. Log into your Apple Developer Account
  2. Go to Certificates, Identifiers & Profiles > Keys
  3. Click the blue plus (+) icon

APNs Create Key

Note
If you don’t see the plus icon, contact your Admin for access.

Step 2: Configure the Key

  1. Enter a descriptive name for the key (e.g., “Ocamba Push Key”)
  2. Select Apple Push Notifications service (APNs)
  3. Go to configure button

APNs Enter Key Name

  1. Ensure that Sandbox & Production is selected

APNs Select Certificate Environment

Step 3: Register and Download

  1. Click Continue, then Register
  2. Download your .p8 key immediately and store it securely
Warning
You can only download the .p8 key once. If you lose it, you must revoke the key and create a new one.

Step 4: Note Your Key Details

After creating the key, note the following information (you’ll need these when uploading to Ocamba):

  • Key ID — Displayed in the Keys section next to your key name
  • Team ID — Found in the top-right corner of your Apple Developer account
  • App Bundle ID — Found in the Identifiers section or in Xcode under Main App Target > Signing & Capabilities

Upload the .p8 Key to Ocamba

  1. Log into your Ocamba Portal
  2. Navigate to Hood > Configurations > Select your configuration > Configuration Tab
  3. Choose .p8 Auth Key as the authentication method
  4. Provide the following information:
    • .p8 File — The private key file you downloaded
    • Key ID — From the Keys section of your Apple Developer account
    • Team ID — From the top-right corner of your Apple Developer account
    • App Bundle ID — Your app’s bundle identifier
  5. Select the Environment:
    • Production — Use for apps distributed via the App Store or TestFlight
    • Sandbox — Use for development builds and testing on physical devices via Xcode
  6. Click Save when done

You’ve successfully set up APNs authentication using a .p8 key in Ocamba. Your iOS app is now ready to send and receive push notifications!


Troubleshooting

Check .p8 File Format

Open the .p8 file in a text editor. It should look like this:

-----BEGIN PRIVATE KEY-----
64 character line
64 character line
64 character line
8 character line
-----END PRIVATE KEY-----

Ensure You Didn’t Upload a .p12 by Mistake

  • .p8 keys come from the Keys section of your Apple Developer account
  • .p12 certificates are from the Certificates section — these are not compatible with .p8 authentication

Confirm You Have the Correct Key ID

  • Go to your Apple Developer > Keys section
  • Match the Key ID you entered in Ocamba with the one listed for the downloaded .p8 key

Verify the Team ID

  • Your Team ID appears in the top-right corner of your Apple Developer account
  • Make sure it is copied exactly and matches the account where the key was generated

Ensure the Key Has APNs Capability

  • When viewing your key in Apple Developer, the Apple Push Notifications service (APNs) capability should be listed
  • If not, revoke the key and create a new one

Wait a Few Minutes

  • Newly created keys may take 10–15 minutes to propagate before Apple allows external authentication
  • If you get validation errors immediately after creation, wait and try again

When All Else Fails

  • Revoke the current .p8 key and create a new one from scratch
  • Double-check you’re using a valid Bundle ID from the same account the key was created under

FAQ

Do I Need a Provisioning Profile?

Yes, Apple requires different types of profiles for development, testing (Ad Hoc), and distribution to the App Store. In Xcode, you can select Automatically manage signing to create one automatically.

Otherwise, see Apple’s docs on provisioning profiles for details.

Can I Use the Same .p8 Key for Multiple Apps?

Yes! A single .p8 key can be used for all apps within the same Apple Developer account. This is one of the advantages over .p12 certificates.

What’s the Difference Between .p8 and .p12?

  • .p8 Token-Based Key (Recommended — You are here): Never expires, works for all apps in your Apple Developer account, simpler setup process.
  • .p12 Certificate: Expires after 1 year and requires annual renewal, single app only, more complex setup.

Additional Resources


Next Steps

After configuring your APNs credentials, continue with the iOS SDK Setup to integrate the Hood SDK into your app.