Mobile API Best Practices · Mobile Auth, Security & Flaky Networks

App Attestation & API Abuse From Fake Clients

App Attest, Play Integrity and what they can (not) prove.

Anyone can call your API with curl and a token from a real login. App attestation gives the server evidence that a request comes from your genuine, unmodified app on a genuine device: Apple App Attest (DeviceCheck) and Google Play Integrity API issue signed verdicts you verify server-side. Use attestation as a risk signal on sensitive actions (signup, payments, promo redemption), combined with rate limits and fraud scoring — not as authentication, and not as a hard requirement everywhere (devices fail attestation for benign reasons).

Client integrity tools

Criterion App Attest (iOS) Play Integrity (Android) Certificate pinning
Proves Key generated by genuine app on Apple device App integrity, device integrity, licensing verdicts Server identity to the app
Verification Server verifies attestation + assertions Server decrypts/verifies token via Google Client-side
Defeats Scripts, modified apps (raises cost) Emulators, tampered apps (raises cost) Some MITM (not a determined attacker)
Operational risk Quotas, rollout Quotas, false negatives Bricked apps on cert rotation
Use for High-risk actions High-risk actions Rarely; prefer platform TLS + CT

Python (risk-based gate)

async def redeem_promo(req: RedeemRequest, user: User, integrity_token: str | None):
    verdict = await verify_integrity(integrity_token, nonce=req.nonce) if integrity_token else None
    risk = score(user, req, verdict)               # attestation is one signal among many
    if risk > 0.9:
        raise Forbidden("action_blocked")
    if risk > 0.6:
        return step_up_challenge(user)             # e.g. OTP or captcha
    return await promos.redeem(user, req.code, idempotency_key=req.idempotency_key)

Common pitfalls

  • Treating attestation as authentication.
  • Hard-failing all requests when attestation is unavailable.
  • Reusing attestation nonces (replay).

Key points

  • Verify verdicts server-side with fresh nonces
  • Use as a risk signal on sensitive actions
  • Combine with rate limits and fraud scoring

Further reading: Google Play Integrity API

Practice questions

Why isn't app attestation a replacement for authentication?

Answer

It proves the app/device is genuine, not who the user is; attackers can also use genuine devices, so it's only one signal.

What does certificate pinning protect against and why is it risky?

Answer

It makes MITM with a different trusted CA harder, but a certificate rotation mistake can make every installed app unable to connect; prefer platform TLS defaults unless you have strong reasons.

Open in the app to mark lessons complete, take notes and track your progress.