Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Flutter and app store releases

Android App Check rejects every token with 403 App attestation failed

Your error

com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.2 more lines it can show

Fix it fast

Most common cause, 1 of 3

App Check holds the upload or debug fingerprint, not the Play app signing key

Copy the SHA-256 of the app signing key certificate from Play Console, App integrity.

Fix
# Firebase console path, no CLI step:
# Security > App Check > Apps > <your Android app> > Play Integrity
# paste the Play "App signing key certificate" SHA-256, then Save
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Firebase App Check returns 403 App attestation failed when the Play Integrity result does not match your registered Android app. Usually App Check holds the upload or debug SHA-256 instead of the Play app signing key, Play Console never linked the Firebase project, or the build was not installed from Google Play. Applies to Firebase BoM 35.2.0.

  • Applies to Firebase Android BoM 35.2.0, firebase-appcheck-playintegrity 20.1.0, firebase-appcheck-debug 20.1.0, Google Play Console App integrity page
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Print every SHA-256 your Gradle project can sign with, then open Play Console at Release, Setup, App integrity and copy the app signing key certificate. Compare both with the fingerprint saved under Security, App Check, Apps in the Firebase console. A mismatch is cause 1, a missing Link Cloud project is cause 2, and a debug or sideloaded install is cause 3.

Run this first
./gradlew signingReport

Then find the line you see in this list and open its fix:

  1. 1App Check holds the upload or debug fingerprint, not the Play app signing keyThe SHA-256 under App Check, Apps matches a line from signingReport, but not the app signing key certificate shown in Play Console
  2. 2Play Console never linked the Play Integrity API to the Firebase projectThe Play Integrity API section under App integrity still offers Link Cloud project, or shows a Cloud project other than your Firebase one
  3. 3The build was not installed from Google Play, so Play cannot recognise itOnly builds run from Android Studio, sideloaded APKs, emulators or CI fail; the same version installed from a Play testing track works

What does the error look like?

  • com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.
  • com.google.firebase.FirebaseException: Too many attempts.
  • Firebase App Check dashboard shows the app's requests as rejected after enforcement is turned on

Cause 1 of 3

App Check holds the upload or debug fingerprint, not the Play app signing key

You seeThe SHA-256 under App Check, Apps matches a line from signingReport, but not the app signing key certificate shown in Play Console

Check

A 403 App attestation failed reply often means App Check knows a different certificate from the one that signed the installed app. When Play App Signing is on, the bundle you upload is signed again by Google with a separate key, so the certificate on users' phones is not your upload certificate. Firebase also keeps two lists: Project settings fingerprints, and the separate App Check Play Integrity registration.

Check
# signature of the bundle you uploaded (upload key, not what Play ships)
keytool -printcert -jarfile app-release.aab

Fix

Copy the SHA-256 of the app signing key certificate from Play Console, App integrity. In the Firebase console open Security, App Check, Apps, pick the Android app, open the Play Integrity provider and save that fingerprint there. Saving it only under Project settings does not register it with App Check.

Fix
# Firebase console path, no CLI step:
# Security > App Check > Apps > <your Android app> > Play Integrity
# paste the Play "App signing key certificate" SHA-256, then Save

Verify

A Firebase contributor notes that changes can take around 15 minutes to reach the verification servers. After that, install the build from the Play link again and watch App Check metrics count the requests as verified.

Verify
adb logcat | grep -i appcheck

Confirmed by github.com

Did this fix it?

Cause 2 of 3

Play Console never linked the Play Integrity API to the Firebase project

You seeThe Play Integrity API section under App integrity still offers Link Cloud project, or shows a Cloud project other than your Firebase one

Check

App attestation fails when Play Integrity is tied to no Google Cloud project, or to the wrong one. Firebase's setup steps say the project you link in Play Console must be the same Firebase project in which the app is registered for App Check.

Check
# Play Console > <your app> > Release > App integrity
# look at the Play Integrity API section: which Cloud project is linked?

Fix

In Play Console open the app, go to Release, App integrity, and in the Play Integrity API section choose Link Cloud project, then pick your Firebase project. Only a direct Owner of that project can do it; Owner through a group membership is not enough.

Fix
# Play Console > Release > App integrity > Play Integrity API
# Link Cloud project > select the Firebase project used by google-services.json

Verify

The section now names the Firebase project, and a fresh Play install gets tokens instead of 403 replies.

Verify
adb logcat | grep -i "App attestation failed"

Confirmed by firebase.google.com

Did this fix it?

Cause 3 of 3

The build was not installed from Google Play, so Play cannot recognise it

You seeOnly builds run from Android Studio, sideloaded APKs, emulators or CI fail; the same version installed from a Play testing track works

Check

By default App Check requires the PLAY_RECOGNIZED label, and apps that Google Play did not distribute are not eligible for it. A debug run or an APK copied onto a phone therefore fails attestation even when your fingerprints are correct.

Check
adb devices -l

Fix

For development and CI builds, install the debug provider factory and register its debug secret under Manage debug tokens. If you really ship outside Google Play, change the app's advanced settings in App Check, Apps to match that distribution channel instead.

Fix
// app/build.gradle.kts, debug builds only
debugImplementation("com.google.firebase:firebase-appcheck-debug")

// in the debug source set, before any other Firebase call
FirebaseApp.initializeApp(this);
FirebaseAppCheck.getInstance().installAppCheckProviderFactory(
    DebugAppCheckProviderFactory.getInstance());

Verify

Logcat prints a DebugAppCheckProvider line asking you to enter a debug secret; once that secret is registered, requests from the debug build pass.

Verify
adb logcat | grep DebugAppCheckProvider

Confirmed by firebase.google.com

Did this fix it?

How do I stop it coming back?

  • Write the Play app signing SHA-256 into the project README and register it in both Firebase lists the day you enable Play App Signing.
  • Keep the debug provider in the debug source set only, so a release bundle can never carry it.
  • Watch App Check request metrics for a few days after shipping the provider, and turn on enforcement only when legitimate traffic shows as verified.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: QistLock, SessionBird, Workforce.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.