'FirebaseError: AppCheck: Fetch server returned an HTTP error status. HTTP status: 403. (appCheck/fetch-status-error)

I try to use Firebase Appcheck and Emulator together during development process. I thought that Appcheck can work when deployment completed but it doesn't work after deployment too. However,debug console return below error when It try to upload a file to the storage.

FirebaseError: AppCheck: Fetch server returned an HTTP error status. HTTP status: 403. (appCheck/fetch-status-error).

  1. Appcheck for Firebase Storage : Enforced from Firebase Console - Appcheck

  2. Storage.rules is as follows:

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth!=null;
    }
  }
}
  1. Related initialization code at the top of index.html body as follows:
   <script>self.FIREBASE_APPCHECK_DEBUG_TOKEN = true;
  initializeAppCheck(app , {
    provider: ReCaptchaV3Provider("My Recaptha V3 Site Key"),
    isTokenAutoRefreshEnabled: true,
  });
  </script>
  1. AppCheck activating code in main.dart as follows:
await FirebaseAppCheck.instance.activate(
      webRecaptchaSiteKey: 'My Recaptha V3 Site Key',
    );
  1. I activate AuthEmulator and StorageEmulator when debug mode activated.
await FirebaseAuth.instance.useAuthEmulator('localhost', 9099);
await FirebaseStorage.instance.useStorageEmulator('localhost', 9199);

How to get rid of the error ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source