Firebase App Check in FireCMS Cloud
FireCMS Cloud can enforce Firebase App Check on every request your admin panel makes to Firestore and Storage, so only your own CMS can read or write your data — not a copied API key, and not a script lifted out of your bundle.
App Check itself is a Firebase service. This page covers wiring it into FireCMS; for what App Check does and which attestation providers exist, see Firebase’s own App Check documentation.
You can enable Firebase App Check in your app directly in the project settings in the FireCMS Cloud console,
or by providing the appCheck prop in your app configuration.
By implementing it in code, you can have more control over the configuration and the provider you want to use, including custom providers.
You can define some options:
provider: The provider you want to use.isTokenAutoRefreshEnabled: Whether to automatically refresh the token.debugToken: A debug token to use.forceRefresh: Whether to force a token refresh.
Providers
Section titled “Providers”The provider property is required and should be an instance of a Firebase AppCheck provider.
You can use one of the following providers:
ReCaptchaEnterpriseProvider
Section titled “ReCaptchaEnterpriseProvider”In order to set up the ReCaptchaEnterpriseProvider, you need to create a new reCAPTCHA Enterprise site key. Follow the instructions in the Firebase documentation.
import {FireCMSAppConfig} from "@firecms/cloud";import {ReCaptchaEnterpriseProvider} from "@firebase/app-check";
const appConfig: FireCMSAppConfig = {
version: "1",
appCheck: { provider: new ReCaptchaEnterpriseProvider("your-site-key") },}
export default appConfig;ReCaptchaV3Provider
Section titled “ReCaptchaV3Provider”In order to set up the ReCaptchaV3Provider, you need to create a new reCAPTCHA v3 site key. Follow the instructions in the Firebase documentation.
import {FireCMSAppConfig} from "@firecms/cloud";import {ReCaptchaV3Provider} from "@firebase/app-check";
const appConfig: FireCMSAppConfig = {
version: "1",
appCheck: { provider: new ReCaptchaV3Provider("your-site-key") },}
export default appConfig;Custom provider
Section titled “Custom provider”You can also create a custom provider by implementing the AppCheckProvider interface.
Check your configuration
Section titled “Check your configuration”FireCMS Cloud provides Firebase App Check to your code, so the provider you create runs on the same copy of the SDK as FireCMS itself. Two things make that work:
- Import from
@firebase/app-check, as the examples above do, not fromfirebase/app-check. Only imports that name a shared package exactly get FireCMS’s copy. Afirebase/app-checkimport makes the build point at a file it never produces, and the app shows “Error loading remote config”. - Keep
@firebase/app-checkin thesharedsection of the federation plugin in yourvite.config.ts. The FireCMS Cloud template already lists it.
The shared section of the template looks like this. generate: false means your build carries
no copy of the package and uses the one FireCMS provides:
federation({ name: "remote_app", filename: "remoteEntry.js", exposes: { "./config": "./src/index" }, shared: { "react": { generate: false }, "react-dom": { generate: false }, "react/jsx-runtime": { generate: false }, "react/jsx-dev-runtime": { generate: false }, "@firecms/cloud": { generate: false }, "@firecms/core": { generate: false }, "@firecms/firebase": { generate: false }, "@firecms/ui": { generate: false }, "@firebase/firestore": { generate: false }, "@firebase/app": { generate: false }, "@firebase/functions": { generate: false }, "@firebase/auth": { generate: false }, "@firebase/storage": { generate: false }, "@firebase/analytics": { generate: false }, "@firebase/remote-config": { generate: false }, "@firebase/app-check": { generate: false }, }})For the complete file, see the
FireCMS Cloud template’s vite.config.ts.
