Cannot upload to Firebase Storage using Flutter Mobile
Here are the steps to get the webRecaptchaSiteKey
according to the documentation:
Add Firebase to your JavaScript project if you haven’t already done so.
Register your site for reCAPTCHA v3 and get your reCAPTCHA v3 site key and secret key.
Register your apps to use App Check with the reCAPTCHA provider in the Project Settings > App Check section of the Firebase console. You will need to provide the secret key you got in the previous step.
After following these steps, you can pass the site key (public key), say 'abcdefghijklmnopqrstuvwxy-1234567890abcd', from step 2 and use it like below:
await FirebaseAppCheck.instance.activate(webRecaptchaSiteKey: 'abcdefghijklmnopqrstuvwxy-1234567890abcd');
Xordelish
Updated on December 02, 2022Comments
-
Xordelish over 1 year
I'm new to Flutter and I'm stuck trying to upload an image from a Flutter App to Firebase Storage. It always throws the same exception:
W/ExponenentialBackoff( 1185): network unavailable, sleeping. W/StorageUtil( 1185): Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: 16:
I have already connected my Firebase Console to my Flutter App. My Firestore is working, except for Cloud Storage. I believe it's because of the App Check that needs to be configured using a recaptcha key to be run in "main.dart" below Firebase.initializeApp(), as FlutterFire specifically instructs: https://firebase.flutter.dev/docs/app-check/usage#activating-the-default-provider
await FirebaseAppCheck.instance.activate(webRecaptchaSiteKey: 'recaptcha-v3-site-key');
Thing is, I don't know where to find that recaptcha key from my Firebase Console or how to set it up. I've tried plugging in the WEB API KEY in my Firebase Project but it still doesn't work. Can anyone help?
-
Maciej Caputa over 2 yearsDid you solve the problem?
-
Xordelish over 2 yearsdidn't . my problem wasnt on firebaseappcheck, it was just my internet connection having a different proxy.
-
-
Xordelish almost 3 yearsI forgot to mention, my app is not web. And what "site" will I register, if in mobile development?
-
silexcorp over 2 yearsThis is the official documentation, this should solve your doubts, for mobile development: firebase.flutter.dev/docs/app-check/usage