I followed the steps described here:
https://firebase.google.com/docs/app-check/flutter/default-providers
And I set up my token here:
https://console.cloud.google.com/security/recaptcha
although it says “Finish setting up your key: Request scores”, it doesn’t seem like this applies to my flutter web app. I also switched on Disable domain verification
, just to make sure it’s not blocking localhost (although I added localhost
to the domains list).
In the app, I added the tag to index.html <script src="https://www.gstatic.com/firebasejs/9.14.0/firebase-app-check.js"></script>
and I’m initiating app check like so:
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
final appCheck = FirebaseAppCheck.instance;
print("we're also here");
appCheck.activate(
webProvider: ReCaptchaV3Provider(appCheckToken),
);
In the Firebase console, I registered the web app with appchceck
Once I started enforcing appcheck, the app doesn’t connect anymore, and in the app check request metrics
, it shows no verified requests and the new requests being made are shown as invalid:
And the app is getting rejected with 400. Details from the network tab:
Request URL:https://content-firebaseappcheck.googleapis.com/v1/projects/opincare-fbd30/apps/1:158357163473:web:33f42ed1a1c65248df2970:exchangeRecaptchaV3Token?key=AIzaSyCnQuY6rcVU4JTXH85GmBpYXNkd0K_cFpw
Request Method:POST
Status Code:400 Bad Request
Remote Address:172.217.17.138:443
Referrer Policy:strict-origin-when-cross-origin
In the debug console, it shows this:
[2024-06-01T13:04:40.535Z] @firebase/app-check:
[2024-06-01T13:04:40.537Z] @firebase/app-check:
Error
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 299:10
createErrorWithStack
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 355:28 _throw
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/core/errors.dart 120:5 throwWithStackTrace
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1385:11 callback
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 40:11 _microtaskLoop
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/schedule_microtask.dart 49:5 _startMicrotaskLoop
Any help would be valued.
1