javascriptrecaptcharecaptcha-v3

Google ReCaptcha V3 - Missing required parameters: sitekey


I'm trying to implement Google ReCaptcha V3 (which is a different implementation from V2, so please don't mark as duplicate).

Here's my page's JS script that initializes the ReCaptcha (Replacing MyKey with my actual key I registered here):

<script src="https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key"></script>
<script>
    $(function () {
       grecaptcha.ready(function () {
           grecaptcha.execute('MyKey', {action: 'homepage'});
       });
    });
</script>

When loading the page I get the following error in the browser's dev console:

Uncaught Error: Missing required parameters: sitekey

What am I missing here?


Solution

  • Replace reCAPTCHA_site_key on https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key with your actual key.