I tried to set up reCAPTCHA, on my page by following the instructions here. I signed up for an API key pair and was issued a public key and a private key. It was not clear, to me, how the private key should be used and I could not find more information about it. It does not appear to be used on the page where reCAPTCHA is called.
I edited my page and put
<script src='https://www.google.com/recaptcha/api.js'></script>
before the closing </head>
tag on my HTML template.
I also put
<div class="g-recaptcha" data-sitekey="my-public-key"></div>
where I want my reCAPTCHA widget to appear.
When I load my page, I get the message
Cannot contact reCAPTCHA. Check your connection and try again.
I also see the reCAPTCHA widget with the text
ERROR for site owner: Invalid site key
I have checked similar questions such as this, where the answer says the key is probably invalid but I have just generated it. I also saw this but I did not disable
Verify the origin of reCAPTCHA solutions
One of the most common reasons why this error occurs is that of an outdated Chrome version. reCAPTCHA will actively look at the browser version before allowing you access. This is applicable to all browser versions, not just Chrome. In this case, the solution is to update Google Chrome to the latest version.
It wasn't obvious to me initially but you have to supply your site key in 2 places:
You need to ensure your site is added in the domains section of the google reCAPTCHA page where you generated the API key and save. Then test again. That worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With