Skip to content
API and Integration

Mobile App Attestation: App Attest and Play Integrity

11 min read

App attestation lets your API check that a request came from a genuine copy of your app on a real device, using Apple App Attest on iOS and Google Play Integrity on Android, directly or through Firebase App Check. It does not replace user authentication and it is not a complete defence. Protect the endpoints where abuse pays, and roll it out in phases: record results first, then limit unattested traffic, and only enforce once old app versions have faded.

What is app attestation, and why does a mobile API need it?

App attestation is a way for your API to ask the device’s platform, rather than the app itself, whether a request came from a genuine, unmodified copy of your app. Apple and Google sign the answer, so a script that copies your API calls cannot simply claim to be your app.

A mobile API needs this because everything in the app can be read and copied. Endpoints, request formats and even API keys can be lifted from the app package or from network traffic, so a script can call your API exactly as the app does. Apple’s documentation makes the same point about client-side checks: a compromised app can falsify their results, which is why the evidence has to come from the platform.

Without attestation, your API can tell who the user is, from their sign-in token, but not what is making the request. That gap is what lets scripts that sign in with real accounts reserve stock, claim rewards or test stolen passwords at scale. Our guide to why a pen test can pass while bots still get in covers that kind of abuse in more detail.

What does attestation prove, and what does it not?

Attestation proves that a request came from a genuine copy of your app on a device the platform recognises. It does not prove that the person using the app is honest, and it does not stop every kind of abuse.

The platform documentation is clear about the limits:

  • Apple says a compromised version of your app on a genuine, unmodified Apple device cannot create valid assertions, but an attacker who modifies the device’s operating system might bypass the restrictions. It provides a risk metric to help spot one compromised device serving many app instances.
  • Google describes Play Integrity as working best alongside other signals as part of an overall anti-abuse strategy, and not as your sole anti-abuse mechanism.
  • Firebase says App Check prevents some, but not all, abuse directed at your backends, and that it does not guarantee all abuse is eliminated.

In practice, attestation raises the cost of abuse considerably. A script can no longer call your API from a server on its own. It needs real devices running your real app, and one device serving many accounts shows up in Apple’s risk metric and in your own logs. A determined person can still automate a genuine app on a genuine phone, which is why attestation sits alongside rate limits, per-account limits and telemetry rather than replacing them.

How does Apple App Attest work?

App Attest creates a key pair in the device’s Secure Enclave, asks Apple to certify that the key belongs to a genuine instance of your app, and then uses that key to sign requests to your server. It is available from iOS 14, according to Apple’s DCAppAttestService documentation.

The flow has three steps:

  1. Generate a key. The app calls generateKey once for each user account on each device and stores the key identifier. The private key never leaves the Secure Enclave.
  2. Attest the key. The app fetches a one-time challenge from your server, at least 16 bytes long, and calls attestKey with a hash of it. Apple returns an attestation object, which the app sends to your server. Your server verifies it and stores the public key against that user and device.
  3. Assert on later requests. For each protected request, the app fetches a new challenge, hashes it together with the request, and calls generateAssertion. Your server checks the signature against the stored public key.
How Apple App Attest works: the app attests a key with Apple once, then signs each protected request to your server
A sequence of Apple App Attest between three participants: Apple, your app and your server. 1: the app generates a key pair in the Secure Enclave, one per user per device. 2: the app asks your server for a one-time challenge. 3: your server returns a challenge of at least 16 bytes. 4: the app calls attestKey with a hash of the challenge, which goes to Apple. 5: Apple returns an attestation object. 6: the app sends the attestation object and key identifier to your server. 7: your server checks the certificates and challenge, then stores the public key for that user and device. 8: on each protected request, the app signs the request with generateAssertion over a new challenge. 9, highlighted: your server checks the signature against the stored key, plus the challenge and counter. Steps 1 to 7 run once per user per device, and again after a reinstall, device migration or restore. Steps 8 and 9 run on each protected request, without your server contacting Apple.

Several details from Apple’s guide to establishing your app’s integrity shape how you build it:

  • Check support first. Not every device supports App Attest, so the app reads isSupported and bypasses the service gracefully when it is false. Your server then cannot require assertions from that device, so it needs another path. Most app extension types are not supported either.
  • Keys do not survive everything. Keys remain valid through app updates, but not through reinstallation, device migration or restoring from a backup. The app has to generate and attest a new key in those cases.
  • Use one key per user per device. Apple advises against sharing a key between users on one device, because it makes a compromised device serving many users harder to detect.
  • Test in the sandbox. Development builds use a separate sandbox environment, so test devices do not pollute their production key counts. Apps distributed through TestFlight, the App Store or the Apple Developer Enterprise Program always use production.

Your server can also request a risk metric from Apple, an approximate count of attested keys for your app on that device over the past 30 days, as described in assessing fraud risk. A count higher than you normally see may indicate one compromised device serving many copies of your app.

How does Google Play Integrity work?

Play Integrity gives your server a signed verdict about the app, the device and the account that installed it, which your server decrypts through Google. Google offers two kinds of request, and the Play Integrity overview describes the difference:

  • Standard requests can be made on demand, with a latency of a few hundred milliseconds on average. They suit most protected API calls. Your server decrypts the token by calling Google’s servers.
  • Classic requests take a few seconds on average and are meant for infrequent, high-value actions.

The integrity verdicts your server receives include:

  • App integrity: PLAY_RECOGNIZED when the app matches the version distributed through Google Play, UNRECOGNIZED_VERSION when it does not, or UNEVALUATED.
  • Device integrity: by default, MEETS_DEVICE_INTEGRITY for a genuine Android device with Google Play services. MEETS_BASIC_INTEGRITY and MEETS_STRONG_INTEGRITY are opt-in labels. An empty value means the device failed.
  • Account details: LICENSED, UNLICENSED or UNEVALUATED. A sideloaded app, or one not acquired from Google Play, returns UNLICENSED.
  • Request details: the package name, a request hash or nonce, and a timestamp, which your server checks against the original request before trusting anything else.

Google also offers opt-in signals, such as recent device activity levels, whether other apps are capturing or controlling the screen, and a Play Protect verdict.

Two practical limits matter for planning. The setup documentation gives a default quota of 10,000 requests a day per Google Cloud project, and raising it requires a linked project, a request form and the app being on Google Play, with processing taking up to a week. On Android 13 and higher, the basic and strong device labels are only returned when the app is licensed, which affects apps distributed outside Google Play.

Should you use Firebase App Check?

Firebase App Check is a good choice when you want one approach across iOS and Android without building both verification paths yourself. It uses App Attest or DeviceCheck on Apple platforms and Play Integrity on Android, and issues your app a short-lived token that your API verifies.

App Check is not limited to Firebase’s own services. The guide to protecting a custom backend has the app send its token in an X-Firebase-AppCheck header. Your API verifies it with the Firebase Admin SDK or by checking the token’s signature against Firebase’s published keys. An optional replay protection feature, in beta at the time of writing, lets a token be used only once on your most sensitive endpoints, at the cost of an extra network call.

The trade-off is visibility. Firebase’s request metrics screen covers Firebase products, and for a custom backend you need your own monitoring of how many requests pass, fail or arrive without a token. You also take a dependency on Firebase in your app and your API, which matters to some organisations more than others.

If you build directly on App Attest and Play Integrity instead, you write and maintain two verification paths, but you see the raw verdicts and can act on the detail, such as treating UNRECOGNIZED_VERSION differently from a failed device check.

In a React Native or Expo app, either route needs a native module, because App Attest and Play Integrity are native platform APIs. Check that whichever module you use is maintained and supports the request types you need.

Which endpoints should you protect?

Protect the endpoints where automated abuse pays, and leave ordinary reads alone. Apple notes that you typically reserve assertions for sensitive moments in the app’s life, and Google suggests identifying high-value or sensitive actions to protect rather than denying access outright.

In our experience, the endpoints worth protecting first are:

  • Sign-in and token refresh, where credential stuffing happens.
  • Account creation, where fake accounts for rewards or extra allowances are made.
  • Anything in limited supply, such as reserving, buying or claiming.
  • Rewards, referrals and promotions, where value can be extracted at scale.
  • Endpoints that expose personal data in bulk, where scraping does the damage.

Protecting fewer endpoints keeps latency and quota use down, and makes each failure easier to investigate.

How do you roll it out without locking out real users?

Roll it out in phases, recording results before acting on them. Every platform’s own guidance points the same way:

  • Apple suggests enabling App Attest in stages if you have a large user base, because Apple may throttle attestation traffic when many users receive the update at once. Its guidance on preparing to use App Attest suggests ramping up no more than 10 million users a day, and keeping attestKey calls below 100 a second across all installations.
  • Google advises gathering telemetry and understanding your audience before taking action, using a tiered enforcement strategy rather than a single allow or deny, and rolling out very high volume changes gradually.
  • Firebase suggests waiting for more users to update before enforcing if many requests still come from outdated clients, because enforcement breaks app versions without the App Check SDK.
Rolling out app attestation in phases: record, measure, limit unattested traffic, then enforce and keep watching
A five-stage phased rollout of app attestation. Stage 1, record: ship the SDK while the API accepts every request and logs the result. Stage 2, measure: pass rates by platform, app version and endpoint. Stage 3, highlighted, limit: unattested requests get tighter limits or an extra step. A gate follows: wait until old app versions are a low share of traffic. Stage 4, enforce: require attestation on the chosen endpoints. Stage 5, watch: failure rates, fallback use and support contacts.

In our experience, five phases work well:

  1. Record. Release an app version that attests, while the API accepts every request and logs whether it passed, failed or arrived without attestation. Nothing changes for users.
  2. Measure. Break the results down by platform, app version, device type and endpoint. Look for failures that come from real users, such as unsupported devices or app extensions, before you look for abuse.
  3. Limit. Treat unattested requests differently without blocking them: tighter rate limits, fewer items per request, a lower place in a queue, or an extra verification step. Real users on older versions can still use the app, and scripts lose their advantage.
  4. Enforce. Once old app versions are a small share of traffic, require attestation on the endpoints you chose. Pair it with a minimum supported app version so users on older versions are asked to update, and time it for a quiet period rather than your busiest day.
  5. Watch. Keep monitoring pass rates, the use of your fallback paths and support contacts, because platform changes, new devices and new kinds of abuse all move the numbers.

What should your API do when a check fails?

Your API should choose a response based on what failed and how sensitive the endpoint is, rather than refusing every failure. Google suggests a range of responses, from allowing, through allowing with limits or after an extra check, to denying.

Some rules hold across both platforms:

  • Bind each check to the request. Use a fresh server challenge for App Attest, and a request hash for Play Integrity standard requests, so a valid result cannot be replayed on a different request.
  • Do not cache verdicts. Google warns against caching integrity verdicts, because a cached result can be reused by a proxy.
  • Never verify on the device. All verification happens on your server, and keys and secrets used for verification never ship in the app.
  • Keep a path for unsupported devices. A device that cannot attest is not the same as a device that failed, so give it a limited route rather than none.
  • Log every outcome. Record the result against the account, device and app version, so you can tune limits and spot one device serving many accounts.

What about staff apps distributed privately?

Staff apps need a check on how your distribution route affects attestation before you rely on it. On iOS, Apple says apps distributed through the Apple Developer Enterprise Program use the App Attest production environment, as App Store apps do. On Android, an app not acquired from Google Play returns an UNLICENSED licensing verdict, and some device labels on Android 13 and higher depend on the app being licensed, so test the verdicts your private distribution route actually produces.

For apps on managed devices, attestation is often one control among several. Device management, single sign-on and network controls may already tell your API a great deal about the device, and attestation adds evidence that the app itself is genuine.

How do we approach this?

We build iOS and Android apps and the APIs behind them, and we design attestation in from the start where the app has something worth abusing. For apps already in production, our mobile and API security review looks at whether attestation is in place, which endpoints it protects and how failures are handled, alongside authentication, rate limiting and business-logic abuse.

We validate mobile apps against the OWASP Mobile Application Security Verification Standard (MASVS), whether or not we built them. Our guide to mobile API best practices covers the authentication, token storage and rate limiting that attestation sits alongside.

Frequently asked questions

Does app attestation replace user authentication?
No. Authentication tells your API who the user is; attestation tells it whether the request came from a genuine copy of your app. Firebase describes App Check and Firebase Authentication as complementary. You need both, and attestation is one signal among several rather than a complete defence.
What happens on devices that do not support App Attest?
Apple says to check the isSupported property and bypass the service gracefully when it returns false, and notes that your server can then no longer require assertions from that device. Plan a fallback path, such as tighter limits or an extra check, rather than refusing the user.
Can we use Play Integrity if our Android app is not on Google Play?
Partly. Google returns an UNLICENSED licensing verdict when the app was not acquired from Google Play, and on Android 13 and higher some device integrity labels are only returned for licensed apps. Google also requires the app to be on Google Play to raise your request quota.
Should we attest every API request?
Usually not. Apple says you typically reserve assertions for requests at sensitive moments, and Google suggests classic Play Integrity requests only for infrequent, high-value actions. Protect the flows where abuse pays, such as sign-in, account creation, rewards and anything in limited supply.
Do we need Firebase to use App Check?
You need a Firebase project, but not the rest of Firebase. App Check can protect your own backend: the app sends a token in the X-Firebase-AppCheck header and your API verifies it with the Firebase Admin SDK or against Firebase's published keys.

Ready to transform your software?

Let's talk about your project. Contact us for a free consultation and see how we can deliver a business-critical solution at startup speed.