Skip to main content

Push Notifications (APNs)

This guide covers how iOS push notifications are configured for Pivot Mobile across all environments.

Overview

Pivot uses Firebase Cloud Messaging (FCM) to send push notifications. For iOS, FCM requires an APNs Authentication Key (.p8) to communicate with Apple's Push Notification service.

APNs Key Configuration by Environment

Each Firebase project needs the APNs key configured in Firebase Console.

EnvironmentFirebase ProjectBundle IDAPNs Key ID
Devpivot-dev-59310jobs.pivot.devGH9LN6PFT7
Dev 2pivot-dev-2jobs.pivot.dev2GH9LN6PFT7
Staging (QA)pivot-not-production-projectjobs.pivot.qaT993V6JQN3
Productionpivot-incpivot-studio-inc5V69C35FSJ

Team ID (all environments): 2VZTF24GKY

Where Keys Are Stored

APNs keys and configuration are stored in the pivot-devops repository:

pivot-devops/github/secrets/
├── apns-auth-key.p8 # APNs Authentication Key (dev environments)
├── env.dev # Dev environment variables (includes APNs config)
├── env.dev2 # Dev2 environment variables
├── env.default # Staging environment variables
└── env.production # Production environment variables

Environment Variables

Each env file includes:

# APNs Push Notifications (Firebase Cloud Messaging)
APNS_KEY_ID=GH9LN6PFT7 # 10-character key identifier
APNS_TEAM_ID=2VZTF24GKY # Apple Developer Team ID
APNS_BUNDLE_ID=jobs.pivot.dev # iOS Bundle ID

Setting Up APNs for a New Environment

Step 1: Generate APNs Key (if needed)

If you need a new APNs key:

  1. Go to Apple Developer Portal - Keys
  2. Click + to create a new key
  3. Name it (e.g., "Pivot Push Notifications Dev")
  4. Enable Apple Push Notifications service (APNs)
  5. Click Continue, then Register
  6. Download the .p8 file immediately (you can only download it once!)
  7. Note the Key ID (10 characters)
warning

You can only download the .p8 file once. Store it securely in pivot-devops/github/secrets/.

Step 2: Upload to Firebase Console

  1. Go to Firebase Console for your project:

  2. Scroll to Apple app configuration

  3. Select your iOS app

  4. Under APNs Authentication Key, upload to BOTH slots:

    • Development APNs auth key - for Xcode/TestFlight builds
    • Production APNs auth key - for App Store builds
  5. For each upload, provide:

    • The .p8 file
    • Key ID (10 characters)
    • Team ID: 2VZTF24GKY

Step 3: Update Environment Variables

Add the APNs configuration to the appropriate env file in pivot-devops/github/secrets/:

# APNs Push Notifications (Firebase Cloud Messaging)
APNS_KEY_ID=YOUR_KEY_ID
APNS_TEAM_ID=2VZTF24GKY
APNS_BUNDLE_ID=your.bundle.id

Troubleshooting

Push notifications not working on iOS

  1. Check Firebase Console - Verify APNs key is uploaded for the correct environment
  2. Check Key ID - Ensure the Key ID matches the .p8 file
  3. Check Team ID - Should be 2VZTF24GKY for all environments
  4. Check Bundle ID - Must match the iOS app's bundle identifier

"InvalidProviderToken" error

This usually means:

  • Wrong Key ID configured
  • Wrong Team ID configured
  • .p8 file doesn't match the Key ID

Push works in development but not production

Firebase has separate APNs slots for development and production. Ensure BOTH are configured:

  • Development APNs auth key (for Xcode, TestFlight)
  • Production APNs auth key (for App Store)

Important Notes

  1. One .p8 key works for both sandbox and production - The same key file can be uploaded to both APNs slots in Firebase

  2. Keys don't expire - Unlike APNs certificates (.p12), authentication keys (.p8) don't expire

  3. Maximum 2 keys per account - Apple allows up to 2 APNs keys per developer account

  4. Keys are account-wide - One key can be used across multiple apps/bundle IDs

  5. Never commit .p8 files to public repos - Store them only in pivot-devops/github/secrets/ (which is gitignored)