Join our Newsletter — 33% off our NHI Course
Home› Guides› Mobile Push Notification Security Guide: APNs and FCM…
Guide Application Security

Mobile Push Notification Security Guide: APNs and FCM Credentials, Payload Data and Spoofing

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 19 November 2026 13 min read
On this page

The credentials that let a server send push notifications to an app's users are non-human identity secrets, and whoever holds them can message every installed device in your name. Apple Push Notification service (APNs) signing keys and Firebase Cloud Messaging (FCM) service account keys sit on backend servers, in CI pipelines, in third party marketing tools and, too often, in source repositories or app bundles. A leaked key is a ready made phishing channel that arrives on the lock screen with your app's name and icon.

This guide treats push from an identity and data perspective: how APNs and FCM authenticate senders, how to scope, store and rotate those credentials, what should and should not go in a notification payload, and how to stop spoofed or abusive messages. It complements our Firebase Credentials Security Guide, which covers the wider Firebase project, and our Mobile App Security Guide.

Key takeaways

  • Push sender credentials are high impact NHI secrets: an APNs .p8 signing key or an FCM service account key lets the holder send messages that look entirely legitimate.
  • Apple says the authentication token signing key "must remain private to prevent anyone else from generating those tokens", and tells you to revoke it if you suspect compromise.
  • Prefer environment specific and topic specific APNs keys over a single team wide key that works in both Sandbox and Production.
  • For FCM, use the HTTP v1 API with short lived OAuth 2.0 access tokens, and on Google infrastructure use Application Default Credentials rather than downloaded key files.
  • Never ship a push sending credential inside a mobile app. The app only needs its device token; sending happens on your server.
  • Keep sensitive data out of payloads. Send an identifier and let the app fetch details over an authenticated API.

How push delivery and sender identity work

Every push system has three parties: your provider server, the platform push service, and the device. The device registers with the platform and receives a device token (APNs) or registration token (FCM), which the app sends to your backend. When your server wants to notify a user, it calls the platform service with that token, a payload and a credential that proves it is allowed to send for the app.

The security model rests on that sender credential. The platform does not know whether a message is a genuine account alert or a phishing lure; it only checks that the request was signed by a key authorised for the app. That makes the credential, not the network path, the thing to protect.

Device tokens are identifiers rather than secrets in the usual sense, but they are personal data linked to a user and device, and a list of them plus a working sender credential is everything an attacker needs for a mass message. Store them with access controls and delete them when the platform reports they are no longer valid.

APNs credentials: token signing keys

APNs supports certificate based and token based authentication. Apple describes token based authentication as "a stateless way to communicate with APNs" and notes that one token can be used from multiple provider servers and for all or a subset of a company's apps. That convenience is exactly why the signing key is so sensitive.

What Apple issues

When you create an APNs key in the developer account, Apple gives you a 10 character Key ID and "an authentication token signing key, specified as a text file (with a .p8 file extension)". Apple's guidance is to "secure both pieces of information carefully". Your server uses the key to sign a JSON Web Token whose header contains alg (APNs supports only ES256) and kid (the Key ID), and whose claims contain iss (your 10 character Team ID) and iat (the issue time).

Key scope

Apple now offers two kinds of key, and the choice matters for blast radius.

Key typeScope, per Apple documentationSecurity implication
Team-scoped keyGenerates tokens for any topic in the team. Restricted to Sandbox or Production. Applies to all existing and new topics. Maximum of two keys per environment.One leaked Production key can message users of every app in the team.
Topic-specific keyGenerates tokens for specific team topics within a single environment. Up to 200 keys for Sandbox and 200 for Production, with up to 400 topics per key.Limits a leak to the topics the key covers. Lets you give each app, team or vendor its own key.

Older team keys that work in both Sandbox and Production continue to be supported, but Apple recommends "different, environment-specific keys to create distinct workflows and to safely manage your development process". Treat any dual environment key as legacy and plan to replace it: a developer laptop or test server should never hold a key that can send to production users.

Token lifetime

APNs enforces short token lifetimes. Apple's documentation says to refresh the token "no more than once every 20 minutes and no less than once every 60 minutes", and that APNs rejects requests whose token timestamp is more than one hour old with an ExpiredProviderToken (403) error. This limits the value of a stolen token, but not of a stolen key, which can mint new tokens indefinitely until revoked.

Compromise response

Apple's instruction is direct: if you suspect a compromised signing key, "revoke it and request a new one", and for maximum security "close all of your existing HTTP/2 connections to APNs and establish new connections before making new requests". Have the replacement path rehearsed so revocation does not cause a long outage.

FCM credentials: service accounts and OAuth tokens

FCM's HTTP v1 API authorises send requests with "a short-lived OAuth 2.0 access token derived from a service account". Requests carry the token as Authorization: Bearer and need the https://www.googleapis.com/auth/firebase.messaging scope. Client libraries refresh the access token automatically when it expires.

The long lived secret is therefore the service account credential behind the token. Firebase documents two ways to supply it:

  • Application Default Credentials (ADC). If your sender runs on Compute Engine, Google Kubernetes Engine, App Engine or Cloud Functions, ADC uses the attached service account and no key file is needed. This is the option to choose wherever possible.
  • A downloaded service account JSON key. For servers outside Google infrastructure, Firebase says you "need to download a service account JSON file from your Firebase project" and to "securely store the JSON file containing the key". It recommends pointing the GOOGLE_APPLICATION_CREDENTIALS environment variable at the file rather than passing the key in code, calling the environment variable option "more secure" and "strongly recommended".

A downloaded key is a standard Google Cloud service account key, so the controls in our Google Cloud Service Account Keys Security Guide apply: avoid creating keys, prefer workload identity federation for external workloads, keep keys in a secrets manager, rotate them and monitor their use.

Scope matters here too. The default Firebase Admin SDK service account often has broad project rights well beyond sending messages. Create a dedicated service account for the sending service and grant it only the messaging permission it needs. For sending into another project, Firebase names the "Firebase Cloud Messaging API Admin" role, which "allows the service account from the sender project to send messages to the target project". Grant it per target project, not at organisation level.

Legacy FCM server keys

Older FCM integrations used a long lived static server key with the legacy HTTP API. If any system, script or marketing tool still holds one, treat it as a credential to retire: migrate the integration to HTTP v1 with service account based OAuth, then delete the old key from the project and from every place it was stored. Confirm the current status of legacy endpoints in Firebase's own documentation before planning the migration timeline.

Where push credentials leak

Push keys turn up in the same places as other NHI secrets, plus a few that are specific to mobile teams.

  • Source code and app bundles. Developers sometimes test sending from the app itself and leave a server key or .p8 file in the repository or the shipped binary. Anything in an app bundle should be treated as public. Our Secrets in mobile apps guide covers how to find and remove these.
  • CI and build systems. Pipelines that send test notifications hold keys in variables or files that are readable by every job.
  • Third party engagement platforms. Marketing and customer engagement tools ask you to upload your APNs key or FCM service account so they can send campaigns. That vendor now holds a credential that can message all your users.
  • Shared drives and tickets. Keys are emailed or attached to tickets during setup, especially because the .p8 file is a small text file that is easy to paste.
  • Developer machines. Local testing with a production key leaves copies in downloads folders and shell history.

Add APNs key file patterns and Google service account JSON patterns to your secret scanning, and investigate any hit in an app repository as a probable exposure. ATT&CK tracks this class of exposure as T1552.001 Credentials In Files.

Payload data: what belongs in a notification

A notification is not a secure message channel. Its content passes through the platform service, may be stored for later delivery and is often shown on a locked screen.

  • Storage. Apple's documentation says APNs "may store the notification for 30 days or less, depending on the date you specify in the apns-expiration header", and that a value of 0 means APNs attempts delivery once and does not store it. Use short expirations for time sensitive or sensitive content.
  • Size. APNs limits the JSON payload to 4 KB (4,096 bytes), or 5 KB (5,120 bytes) for VoIP. That limit is a hint that payloads are meant to be small signals, not documents.
  • Lock screen exposure. One time codes, balances, health data or message bodies in an alert can be read by anyone holding the phone.

The safe pattern is a thin notification: send an event type and an opaque identifier, let the app wake, authenticate to your API with the user's session and fetch the details. If you must show content, keep alert text generic ("You have a new message") and let users opt in to previews.

Treat any data delivered in a payload as untrusted input on the device. Do not let a push payload trigger privileged actions, such as changing settings, approving a transaction or opening an arbitrary URL, without the app confirming the action with your backend.

Spoofing, phishing and abuse

Because platform services authenticate the sender and not the content, the main spoofing risks come from stolen credentials and from weak controls in your own sending path.

  • Stolen sender credentials. An attacker with your key can send any text, with your app name, to any device token they hold. Mass messages announcing fake prizes, refunds or security alerts are a known pattern after key leaks. Limit who can read device token lists as well as keys.
  • Abused internal send APIs. Many teams wrap the platform in an internal "send notification" service. If that service accepts arbitrary text from any internal caller, or is exposed without authentication, it becomes the weak point. Authenticate callers with workload identity, authorise by template and audience, and rate limit broadcast sends.
  • Console and vendor access. Firebase console users and engagement platform users can often send campaigns directly. Enforce MFA, keep the number of people with send rights small, and require approval for messages to all users.
  • Deep link abuse. Notifications usually carry a link or route. Validate it on the device against an allow-list of in-app routes and domains, so a crafted payload cannot open a phishing page inside a trusted web view.

Our Mobile App Attestation guide covers how to make sure the device tokens registering with your backend come from genuine app instances, which reduces token list poisoning.

Operating push credentials safely

  1. Inventory. List every APNs key (Key ID, type, environment, topics) and every service account used for FCM, plus every system and vendor that holds a copy.
  2. Assign owners. Each key should have a named owning team and a documented purpose.
  3. Separate by environment and by holder. Use separate Sandbox and Production APNs keys, and give each vendor its own topic-specific key or its own service account so you can revoke one without affecting others.
  4. Store centrally. Keep .p8 files and any service account JSON in a secrets manager, injected at runtime. Remove copies from laptops, tickets and repositories.
  5. Prefer keyless where available. Use ADC or workload identity federation for FCM senders instead of downloaded keys.
  6. Rotate and rehearse revocation. Rotate on a schedule and whenever someone with access leaves or a vendor relationship ends. Practise the APNs revoke and replace steps, including closing and reopening connections.
  7. Monitor. Watch sending volume, audience size and failure codes. A spike in sends, unexpected topics, or a burst of InvalidProviderToken errors can signal misuse or an attacker testing a key. Track the apns-id of each notification, as Apple recommends, to support investigation.

The Secrets Rotation Runbook Template provides a structure you can adapt for push credentials.

Common failure patterns

  • One team wide APNs key used for every app, every environment and every vendor, with no record of where copies live.
  • A .p8 file or Firebase service account JSON committed to a mobile repository during early development and never removed from history.
  • The Firebase Admin SDK default service account, with broad project rights, used only to send notifications.
  • Legacy FCM server keys still active in a forgotten script or marketing integration.
  • Marketing vendors given production keys with no contract terms on storage, rotation or breach notification.
  • Sensitive data, including one time codes and account details, placed in alert text that appears on the lock screen.
  • Internal notification services that accept free text from any caller with no rate limits on broadcasts.
  • Device tokens kept after APNs or FCM report them invalid, growing an unnecessary store of personal data.

Practitioner checklist

  • Inventory all APNs keys and FCM service accounts, with owners, environments and holders.
  • Replace dual environment APNs keys with environment specific keys; use topic-specific keys for vendors and separate apps.
  • Move FCM senders to HTTP v1 with ADC or federation; retire legacy server keys.
  • Grant FCM service accounts only messaging rights, per project.
  • Store any remaining key files in a secrets manager and scan repositories and app bundles for them.
  • Apply thin payloads, short apns-expiration values and generic lock screen text for sensitive events.
  • Authenticate, authorise and rate limit internal send services and console access.
  • Validate deep links from payloads on the device.
  • Monitor send volume and authentication errors, and rehearse key revocation.

Standards and references

Related NHI Mgmt Group resources: Firebase Credentials Security Guide · Google Cloud Service Account Keys Security Guide · Secrets in mobile apps · Mobile App Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.