Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reCAPTCHA stopped working - Invalid Encryption

I have been using reCAPTCHA on my site for a while now and suddenly I realized it has stopped to work. The reCAPTCHA is there, however after verifying correctly, the response FAILS which makes the submit of the form fail.

On the client side console, the browser gives an error:

Uncaught (in promise) Invalid Encryption.

I have tried to search for this error but can not find anything similar. After submitting the form, the server side verification in PHP fails. I am not sure if the error above is related, however, it has not been there before.

Example page of client side integration:

<html>
<head>
    <title>reCAPTCHA demo: Simple page</title>
     <script src="https://www.google.com/recaptcha/api.js" async defer> 
</script>
</head>
  <body>
    <form action="?" method="POST">
      <div class="g-recaptcha" data-sitekey="your_site_key"></div>
      <br/>
      <input type="submit" value="Submit">
    </form>
   </body>
</html>

Server side verification PHP:

$response = json_decode( 
    file_get_contents( 
 "https://www.google.com/recaptcha/api/siteverifysecret=MY_SECRET&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR'] ), true );

if($response['success'] == false){
    echo "FAIL";
} else {
    //do something
}

I have followed the instructions found here.

like image 760
Emir Husic Avatar asked Oct 21 '18 15:10

Emir Husic


People also ask

What is reCAPTCHA failed?

reCAPTCHA analyzes interactions with the website to detect if they are made by a human or some form of automated abuse. Sometimes, you may see a "failed reCAPTCHA check" error message while trying to create or amend your account. This means the website believes your actions may be those of a bot.

How do I validate a Google reCAPTCHA on a form?

If you want to check if the User clicked on the I'm not a robot checkbox, you can use the . getResponse() function provided by the reCaptcha API. In case the User has validated himself, the response will be a very long string.

What is reCAPTCHA validation?

What is reCAPTCHA? reCAPTCHA is a free service from Google that helps protect websites from spam and abuse. A “CAPTCHA” is a turing test to tell human and bots apart. It is easy for humans to solve, but hard for “bots” and other malicious software to figure out.


1 Answers

I ran into the same problem yesterday. It looks as though Google has acknowledged the problem and is working toward fixing it. They claim it shouldn't affect the overall function of the reCAPTCHA.

I obtained this information here.

Below is a screen shot of the conversation.

Screen shot of Google forum

like image 144
Jessica Avatar answered Sep 23 '22 11:09

Jessica