firebase-app-check
Skill0 starsChanged 5 months agoMITView on GitHub
Protects Firebase backends from abuse by attesting that requests come from your real app — Play Integrity (Android), App Attest / DeviceCheck (iOS), reCAPTCHA Enterprise (web). Use whenever the user wants to prevent scraping, quota theft, or unauthorized API access to Firestore, Storage, Cloud Functions, or Realtime Database.
- Reads credentials
1 other project uses a version of this.
Adopted by
Most recently taken up by
- evanca/flutter-ai-rulestheir own version, first seen Aug 24, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- evanca/flutter-ai-rules★ 669same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- firebase-ai-logicSkill
- firebase-analyticsSkill
- firebase-architectureSkill
- firebase-authSkill
- firebase-cloud-functionsSkill
- firebase-cost-optimizationSkill
- firebase-crashlyticsSkill
- firebase-emulatorsSkill
- firebase-expoSkill
- firebase-firestoreSkill
- firebase-hostingSkill
- firebase-messagingSkill
- firebase-realtime-databaseSkill
- firebase-remote-configSkill
- firebase-storageSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Must run before any other Firebase call (auth, Firestore, etc).
- Distinctive: line 118
CRITICAL: before enforcing on a live product, monitor the Unverified Requests panel for at least a week to confirm 100% of legitimate …
- Distinctive: line 139
Run the app once — it prints a debug token to the console
- Very specific: line 152
Shipping
__DEV__debug providers to production: Always confirm __DEV__ is false in release builds — the bundler should strip the dev …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Firebase App Check
App Check verifies that incoming traffic to your Firebase services comes from your authentic, unmodified app — not a script, scraper, or repackaged binary. Without it, anyone with your Firebase web config (which ships in your client bundle) can hit your APIs.
Minimum viable example
import appCheck from "@react-native-firebase/app-check";
const provider = appCheck().newReactNativeFirebaseAppCheckProvider();
provider.configure({
android: { provider: "playIntegrity" },
apple: { provider: "appAttestWithDeviceCheckFallback" },
});
await appCheck().initializeAppCheck({ provider, isTokenAutoRefreshEnabled: true });Must run before any other Firebase call (auth, Firestore, etc). Then flip enforcement on per product in the Firebase Console — but monitor unverified traffic for a week first.
1. Register attestation providers
In Firebase Console → App Check → register each app:
| Platform | Provider | Setup |
| iOS | App Attest (iOS 14+) | Automatic — just enable. Falls back to DeviceCheck on iOS < 14. |
| Android | Play Integrity | Requires the app's SHA-256 fingerprint in Firebase Console. |
| Web | reCAPTCHA Enterprise | Create a key in Google Cloud Console, paste site key into Firebase Console. |
For Android: eas credentials shows your SHA-256 — paste into Firebase Console → Project Settings → your Android app → Add fingerprint, then App Check picks it up automatically.
2. Install client (Expo / RN)
npx expo install @react-native-firebase/app-checkapp.json:
{
"expo": {
"plugins": [
"@react-native-firebase/app",
"@react-native-firebase/app-check"
]
}
}Initialize early, before any other Firebase call:
import { Platform } from "react-native";
import appCheck from "@react-native-firebase/app-check";
const provider = appCheck().newReactNativeFirebaseAppCheckProvider();
provider.configure({
apple: {
provider: __DEV__ ? "debug" : "appAttestWithDeviceCheckFallback",
debugToken: process.env.EXPO_PUBLIC_APP_CHECK_DEBUG_TOKEN,
},
android: {
provider: __DEV__ ? "debug" : "playIntegrity",
debugToken: process.env.EXPO_PUBLIC_APP_CHECK_DEBUG_TOKEN,
},
});
await appCheck().initializeAppCheck({
provider,
isTokenAutoRefreshEnabled: true,
});3. Web setup
import { initializeAppCheck, ReCaptchaEnterpriseProvider } from "firebase/app-check";
if (typeof window !== "undefined") {
initializeAppCheck(app, {
provider: new ReCaptchaEnterpriseProvider(process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY!),
isTokenAutoRefreshEnabled: true,
});
}For local dev, set a debug token on the window before init:
if (process.env.NODE_ENV === "development") {
(self as any).FIREBASE_APPCHECK_DEBUG_TOKEN = true; // logs a token to register in console
}Copy the token from the browser console → Firebase Console → App Check → your app → Manage debug tokens.
4. Enforcement (the important step)
Registering App Check does nothing on its own. You must explicitly enforce it per product in the Firebase Console:
- Cloud Firestore: App Check → Firestore → Enforce
- Cloud Storage: App Check → Storage → Enforce
- Realtime Database: App Check → RTDB → Enforce
- Cloud Functions: per-function in code (see below)
CRITICAL: before enforcing on a live product, monitor the Unverified Requests panel for at least a week to confirm 100% of legitimate traffic is sending valid tokens. Enforcing prematurely blocks real users.
Enforcing on a callable Cloud Function
import { onCall, HttpsError } from "firebase-functions/v2/https";
export const sensitive = onCall({ enforceAppCheck: true }, (request) => {
if (!request.app) {
throw new HttpsError("failed-precondition", "App Check required");
}
// ... safe to proceed
});request.app is the verified App Check token. With enforceAppCheck: true the function rejects unverified requests before your handler runs.
5. Debug tokens
For simulators, emulators, and CI, you cannot generate real attestation tokens. Set a debug token:
- Run the app once — it prints a debug token to the console
- Firebase Console → App Check → your app → Manage debug tokens → Add
- Paste the token, give it a name (e.g. "iOS Simulator")
Debug tokens look like real tokens to Firebase; rotate or delete them when team members leave. They bypass attestation.
For full debug token playbook (CI, team rotation, leak detection) see references/debug-tokens.md.
6. Common mistakes
- Enforcing without monitoring first. Blocks every user who hasn't received an updated client with App Check wired. Always monitor unverified traffic for at least a week before flipping enforcement.
- Initializing App Check after Firestore/Auth. Order matters — App Check must be initialized first so subsequent calls attach the token.
- Forgetting Android SHA-256 fingerprints. Play Integrity fails silently if Firebase doesn't know your app signature. Add fingerprints for both debug and release certs.
- Shipping
__DEV__debug providers to production. Always confirm__DEV__isfalsein release builds — the bundler should strip the dev branch automatically, but verify by checking the bundle. - Treating App Check as authentication. It's attestation — it proves the app is legit, not who is using it. Pair with Firebase Auth for user identity.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

