1

I'm implementing the invisible recaptcha on rhe login page on my website, following the official guide about how to "Automatically bind the challenge to a button": https://developers.google.com/recaptcha/docs/invisible#auto_render

My html page is made in this way:

    <head>
[...]
        <script src="js/login.js"></script>
        <script src="https://www.google.com/recaptcha/api.js" async defer></script>
    </head>
    <body>
[...]
            <button type="submit" class="g-recaptcha btn btn-primary" data-sitekey="[...]" data-callback="checkCaptcha" id="loginSubmit">Login <i class="fas fa-sign-in-alt"></i></button>
[...]
    </body>
    </html>

while the javascript file is:

    function checkCaptcha(token) {
        console.log("re-captcha callback invoked.");
        login();
    }


    function login() {
[...]
}

But on the panel page of Google I keep having the message "We detected that your site is not verifying reCAPTCHA solutions. This is required for the proper use of reCAPTCHA on your site. Please see our developer site for more information."

Could some one help me to understand what a I wrong?

Thank you so much in advice.

1 Answer 1

3

When the user solves the captcha puzzle(or clicks on the submit button) at your html page Google recaptcha adds another hidden input value to your <form> named g-recaptcha-response or parse to the given data-callback function. It contains a string value, which you should send back to Google in order to verify the response from the server side.

Without the server-side verification part recaptcha is useless. API request details are as follow,

URL: https://www.google.com/recaptcha/api/siteverify
METHOD: GET / POST(Recommended)

PARAMETERS:

  • secret (Required. The shared key between your site and reCAPTCHA.)
  • response (Required. The user response token provided by reCAPTCHA, verifying the user on your site.)
  • remoteip (Optional. The user's IP address.)

Read the Google's documentation on Verifying the user's response to know more.

2
  • Where to find "The shared key between your site and reCAPTCHA"??
    – Black
    Commented Jul 30, 2018 at 15:13
  • @Black You can find relevant keys at the recaptcha admin panel. Commented Jul 30, 2018 at 15:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.