Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reCAPTCHA:"ERROR for site owner: Invalid site key"

Tags:

recaptcha

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 
like image 562
OtagoHarbour Avatar asked Feb 03 '18 17:02

OtagoHarbour


People also ask

What does this mean your reCAPTCHA was not valid please try again?

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.


2 Answers

It wasn't obvious to me initially but you have to supply your site key in 2 places:

enter image description here

like image 155
Matthew Lock Avatar answered Sep 20 '22 14:09

Matthew Lock


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.

like image 34
Sleek Avatar answered Sep 22 '22 14:09

Sleek