Catch up on everything we announced at this year's Firebase Summit. Learn more

Enable App Check enforcement for Cloud Functions

To begin enforcing App Check token requirements in your callable Cloud Functions, modify your functions to check for valid App Check tokens.

Before you begin

Enable App Check in your Apple, Android, and Web clients.

Add App Check support to a function

  1. Update your project's firebase-functions dependency to version 3.14.0 or newer:

    npm install firebase-functions@">=3.14.0"

    And update your project's firebase-admin dependency to version 9.8.0 or newer:

    npm install firebase-admin@">=9.8.0"
  2. Add a check for to your function. Your function should fail if isn't defined.

    exports.yourCallableFunction = functions.https.onCall((data, context) => {
      // will be undefined if the request doesn't include a valid
      // App Check token.
      if ( == undefined) {
        throw new functions.https.HttpsError(
            'The function must be called from an App Check verified app.')
      // Your function logic follows.
  3. Redeploy your functions:

    firebase deploy --only functions

Once these changes are deployed, your callable Cloud Functions will require valid App Check tokens. The Cloud Functions client SDKs automatically attach an App Check token when you invoke a callable function.