flutterrecaptcharecaptcha-enterprise

How to solve Error: Missing required parameters: sitekey?


Issue with reCAPTCHA and Firebase Initialization in Flutter Web

I am currently working on a Flutter web project and facing an issue with reCAPTCHA and Firebase initialization in my index.html file. Below is the relevant code snippet:

<!DOCTYPE html>
<html>
<head>
  <!-- ... other meta tags and scripts ... -->

  <script src="https://www.google.com/recaptcha/api.js?render=***" defer></script>
</head>
<body>
  <script type="module">
    const firebaseConfig = {
      apiKey: "***",
      authDomain: "***.firebaseapp.com",
      projectId: "***",
      storageBucket: "***.appspot.com",
      messagingSenderId: "***",
      appId: "1:***:web:***",
      measurementId: "G-***"
    };
    const app = firebase.initializeApp(firebaseConfig);
  </script>
</body>
</html>

I'm encountering the following error in the flutter console:

Error: Missing required parameters: sitekey
https://www.gstatic.com/recaptcha/releases/3kTz7WGoZLQTivI-amNftGZO/recaptcha__en.js 69:116   <fn>
https://www.gstatic.com/recaptcha/releases/3kTz7WGoZLQTivI-amNftGZO/recaptcha__en.js 723:204  new zZ
https://www.gstatic.com/recaptcha/releases/3kTz7WGoZLQTivI-amNftGZO/recaptcha__en.js 299:189  <fn>
https://www.gstatic.com/recaptcha/releases/3kTz7WGoZLQTivI-amNftGZO/recaptcha__en.js 638:502  new Hz
https://www.gstatic.com/recaptcha/releases/3kTz7WGoZLQTivI-amNftGZO/recaptcha__en.js 315:264  <fn>
https://www.gstatic.com/firebasejs/9.22.1/firebase-app-check.js 1:16295                       <fn>
https://www.gstatic.com/firebasejs/9.22.1/firebase-app-check.js 1:16525                       <fn>

I have already ensured that I've replaced the placeholders with the actual values for my reCAPTCHA site key and Firebase project details. Despite this, I'm still facing this issue. I have also attached a screenshot of the firebase app check for reference: screenshot link.

Could anyone please help me understand why I'm still getting this error even after providing the correct parameters? Is there anything else I should be considering when configuring reCAPTCHA and Firebase for a Flutter web project? Any insights or guidance would be greatly appreciated.

Thank you in advance for your assistance!


Solution

  • This was my mistake I get the API Key from Google Cloud Console Credentials but I need to get it from https://console.cloud.google.com/security/recaptcha/***/details?project=***