3

I enforced Firebase AppCheck for Firestore.

Now, when I try to access data, I get an error:

    firebase
      .firestore()
      .doc(firestoreRoot.configs.priceIds._pathUrl)
      .get()
      .then((v) => console.log(v.data()));

appcheck error

In Firebase, it says all my requests are unverified:

enter image description here

This only happens for firestore.

Is there something else I must do?

I enabled AppCheck in my app using:

  const appCheck = firebase.appCheck();
  appCheck.activate("MY_SITE_KEY", true);

I tried disabling AppCheck in the firebase console, and now all my requests are accepted.

Simon Tran
  • 1,461
  • 1
  • 11
  • 28
  • 1
    Just to confirm I am looking at the same guide as you, have you looked into the guide on enable App Check with [Web(reCAPTCHA v3)](https://firebase.google.com/docs/app-check/web/recaptcha-provider#web-version-8)? The updated client app will begin sending App Check tokens along with every request it makes to Firebase, but Firebase products will not require the tokens to be valid until you enable enforcement in the App Check section of the Firebase.To view the App Check request metrics for a product, open the Project Settings > App Check section of the Firebase console. – Priyashree Bhadra Jan 09 '22 at 08:20
  • 1
    The request metrics for each product are broken down into four categories: Verified, Outdated Client, Unknown Origin, Invalid. The distribution of these categories for your app should inform when you decide to enable enforcement. Let me know after you get these categories. We can definitely come to a solution. – Priyashree Bhadra Jan 09 '22 at 08:22
  • 1
    Can you have a look at the comments and please respond so that we can go ahead with your issue resolution? – Priyashree Bhadra Jan 11 '22 at 06:10
  • Yes I was following that guide. I had not noticed the warning at the end "Important: Cloud Firestore support is currently available only for Android and iOS clients. If your project has a web app, don't enable Cloud Firestore enforcement until web client support is available.". That is the reason it was not working ! – Simon Tran Jan 12 '22 at 20:52

1 Answers1

2

The firebase documentation says:

Important: Cloud Firestore support is currently available only for Android and iOS clients. If your project has a web app, don't enable Cloud Firestore enforcement until web client support is available.

Therefore, appcheck cannot be used with firestore for web applications.

Tyzoid
  • 1,072
  • 13
  • 31
Simon Tran
  • 1,461
  • 1
  • 11
  • 28
  • 3
    The documentation does not say this anymore, but I have the same problem. – michael May 28 '22 at 09:50
  • Ah, I'm version version 8 still but I guess you have to upgrade to v9: https://firebase.google.com/support/release-notes/js#9.6.0 – michael May 28 '22 at 09:56