K
K
Konstantin2021-10-25 14:16:33
reCAPTCHA
Konstantin, 2021-10-25 14:16:33

Why does grecaptcha return null in token?

Hello. There is such a simple code to check the operation of captcha. It turns out some nonsense in the end. In the grecaptcha.execute request, the token is returned as null. The domain for which this captcha is performed is specified in the recaptcha settings. At first I thought that the domain name was the problem, but I did 3 captchas for 3 different sites and this script always returns null. Has anyone had such a problem? Google is great, they made a service, but there is no support for it. I have no idea where to ask

<script src="https://www.google.com/recaptcha/api.js?render=site_key" ></script>
<script type="text/javascript" >
    grecaptcha.ready(function () {
        grecaptcha.execute('site_key').then(
            function (token) {
                console.log(token);
                // $('input[name="g-recaptcha-response"]').val(token);
                // console.log($('input[name="g-recaptcha-response"]').val())
            }
        );
    });
</script>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question