Push Server: APNs and FCM Setup
This page describes which credentials are needed from Apple and Google Firebase and how they are assigned to a customer app in the Push Server tenant configuration. Android always uses Firebase Cloud Messaging (FCM). iOS uses either direct APNs or FCM, controlled by apns-send-via-fcm.
Provider credentials are separate from the controls that protect the server itself: device attestation, device HTTP signatures, backend JWT trust and the server keystore. See Deployment and Operations for those.
What you need
Section titled “What you need”| Route | From Apple | From Firebase / Google Cloud | Server configuration (per app) |
|---|---|---|---|
| Android | — | Firebase project with the Android app, service-account JSON with FCM send permission, Play Integrity access | application.android-package-name, fcm.service-account-location, attestation.google.service-account-location |
| iOS direct APNs | APNs signing key (.p8), Key ID, Team ID, bundle ID; App Attest |
— | application.apple-team-id, application.apple-app-id, apns.*, global Apple trust keystore |
| iOS through FCM | APNs key uploaded to Firebase; App Attest | Firebase project with the iOS app, service-account JSON | application.apple-*, fcm.service-account-location, global Apple trust keystore |
Apple: APNs signing key
Section titled “Apple: APNs signing key”- In the Apple Developer account (Account Holder or Admin role), open Certificates, Identifiers & Profiles, select the app’s explicit App ID and enable Push Notifications. In Xcode, use the same team and bundle ID and add the Push Notifications capability. For silent and private notifications, also enable Background Modes → Remote notifications.
- Under Keys, create a key with Apple Push Notification service (APNs) enabled. Current Apple keys are environment-specific: create one for Sandbox and one for Production, either team-scoped or topic-specific for the app’s bundle ID. Existing combined sandbox/production keys keep working.
- Download
AuthKey_<KEY_ID>.p8(Apple allows only one download) and note the Key ID.
| Value | Where to find it |
|---|---|
| Team ID | Apple Developer account → Membership details |
| Key ID | Keys → selected APNs key (also part of the file name) |
| Private key | The complete, unchanged .p8 file (PKCS#8 EC P-256 key) |
| Topic | The app’s bundle ID without Team ID prefix, for example com.example.wallet |
The server creates and caches the APNs provider JWTs itself. Do not supply a pre-generated JWT, a .p12 TLS certificate or an App Store Connect API key.
Match the APNs environment
Section titled “Match the APNs environment”The device token’s environment is determined by the app’s provisioning profile, not by the server profile.
| Installed app | M8TY_PUSH_APNS_BASE_URL |
Key |
|---|---|---|
Development provisioning (aps-environment=development) |
https://api.sandbox.push.apple.com |
Sandbox key or combined key |
TestFlight / App Store (aps-environment=production) |
https://api.push.apple.com (default) |
Production key or combined key |
App Attest
Section titled “App Attest”Device registration on iOS is verified with Apple App Attest against application.apple-team-id and application.apple-app-id. Production requires application.apple-production: true (the default) and an Apple trust keystore configured globally with M8TY_PUSH_ATTESTATION_APPLE_TRUST_KEYSTORE and M8TY_PUSH_ATTESTATION_APPLE_TRUST_KEYSTORE_PASSWORD.
Firebase: service account
Section titled “Firebase: service account”- In the Firebase console, select or create the project of the mobile app. Under Project settings → Cloud Messaging, make sure Firebase Cloud Messaging API (V1) is enabled.
- Under Project settings → Service accounts → Firebase Admin SDK, select Generate new private key and download the service-account JSON.
- Make sure the service account may send messages in that project (for a dedicated sender, the IAM role
roles/firebasecloudmessaging.admin). - For Android registration, provide a Google service account with Play Integrity permissions for the app. The same file may be used for FCM and Play Integrity only if its account has both permissions.
The server reads project_id, client_email, private_key, private_key_id and token_uri from the original file; no conversion is needed. google-services.json, GoogleService-Info.plist, Firebase API keys, sender IDs and legacy FCM server keys do not replace the service-account key. FCM has no sandbox URL: use separate Firebase projects when development and production must be isolated.
Mobile app
Section titled “Mobile app”Register the Android app in the same Firebase project with its real package name, integrate Firebase Messaging, and send the resulting FCM registration token to the Push Server at registration and whenever Firebase rotates it. Request notification permission (Android 13+) and create the notification channels referenced by android.channelId.
iOS through FCM
Section titled “iOS through FCM”Register the iOS app in Firebase with the exact bundle ID and upload the APNs .p8 key with Key ID and Team ID under Project settings → Cloud Messaging → iOS app configuration → APNs authentication key. Firebase then handles APNs authentication and environment routing; the server’s APNs settings are not used for this route. The iOS device must register an FCM token.
Per-tenant configuration
Section titled “Per-tenant configuration”Credentials are referenced as files from the imported tenant YAML; in Kubernetes they are mounted from Secrets. Locations must use file: or classpath:.
m8ty: push: tenants: "[customer-a]": enabled: true apns-send-via-fcm: false # optional customer default for iOS routing jwt: issuer-uri: https://identity.example.com/realms/customer-a apps: "[wallet]": enabled: true # apns-send-via-fcm: true # optional app override application: android-package-name: com.example.wallet apple-team-id: TEAM123456 apple-app-id: com.example.wallet apple-production: true fcm: service-account-location: file:/app/tenant-credentials/wallet-firebase.json attestation: google: service-account-location: file:/app/tenant-credentials/wallet-play-integrity.json apns: team-id: TEAM123456 key-id: KEY1234567 topic: com.example.wallet private-key-location: file:/app/tenant-credentials/wallet-apns.p8| Property (relative to the app) | Description |
|---|---|
application.android-package-name |
Android package; required for enabled Android apps |
application.apple-team-id, application.apple-app-id |
Apple team and bundle ID; required for enabled iOS apps |
application.apple-production |
App Attest environment (default true; must be true in production) |
fcm.service-account-location |
Original Google service-account JSON for FCM |
attestation.google.service-account-location |
Google service account for Play Integrity |
apns.team-id, apns.key-id, apns.topic, apns.private-key-location |
Direct APNs signing key; team and topic must match the Apple identity |
apns-send-via-fcm |
iOS routing override; resolution is app, then customer, then global M8TY_PUSH_APNS_SEND_VIA_FCM (default true) |
Global provider settings:
| Variable | Default |
|---|---|
M8TY_PUSH_APNS_BASE_URL |
https://api.push.apple.com |
M8TY_PUSH_APNS_REQUEST_TIMEOUT |
15s |
M8TY_PUSH_FCM_BASE_URL |
https://fcm.googleapis.com |
M8TY_PUSH_FCM_REQUEST_TIMEOUT |
15s |
M8TY_PUSH_APNS_SEND_VIA_FCM |
true |
Startup and deployment validation enforce the following for enabled apps:
| Platform and route | Required credentials |
|---|---|
| Android | fcm.service-account-location and attestation.google.service-account-location |
| iOS through FCM | fcm.service-account-location |
| iOS direct APNs | Complete apns settings |
| Every enabled iOS app | Production App Attest identity and Apple trust keystore |
Further rules:
- Credentials are never shared with or inherited from another app or customer. Sibling apps of one customer may share a Firebase project; different customers may not, and reused service accounts, private keys or APNs team/key pairs across customers are rejected.
- With
apns-send-via-fcm: true, direct APNs tokens are rejected at registration and token replacement (422ERROR_DELIVERY_PROVIDER_NOT_ALLOWED). Withfalse, iOS devices with an APNs token use direct APNs and devices with only an FCM token use FCM. - Provider keys are parsed at startup (Google: PKCS#8 RSA, at least 2048 bits; APNs: PKCS#8 P-256). Changes require a rollout of all replicas; editing a mounted Secret alone does not reload provider clients.
- Outside development, provider URLs are restricted to the official FCM and APNs HTTPS hosts.
Verify the setup
Section titled “Verify the setup”Register the app against the correct server and tenant, send a test message and inspect the delivery diagnostics. HTTP 202 only confirms acceptance.
| Symptom | Check |
|---|---|
APNs BadDeviceToken / DeviceTokenNotForTopic |
Token environment versus APNs URL, bundle ID/topic; an FCM token is not an APNs token |
| APNs authentication rejected | Key enabled for APNs and the environment, Key ID, Team ID, complete .p8, revocation, server clock |
| FCM OAuth failure or permission denied | Complete RSA key, service-account email, FCM API enabled, IAM send permission, target project |
FCM SENDER_ID_MISMATCH / UNREGISTERED |
App’s Firebase project versus configured project; refresh stale tokens |
| No supported provider token | Android needs FCM; direct iOS needs APNs; iOS through FCM needs an FCM token |
| Provider accepted, nothing visible | Notification permission, channels/categories, OS settings, silent versus visible message |
See Also
Section titled “See Also”- Push Server — overview and capabilities
- Push Server: Deployment and Operations — mounting credential files and global configuration
- Push Server: Architecture — provider adapters and tenant model
© m8ty GmbH 2023 · m8ty.eu
