错误:不存在任何reCAPTCHA客户端(reCAPTCHA v3) [英] Error: No reCAPTCHA clients exist (reCAPTCHA v3)

查看:160
本文介绍了错误:不存在任何reCAPTCHA客户端(reCAPTCHA v3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以一种形式集成了reCAPTCHA v3.在onload中,在右下角产生了一个令牌和google captcha徽标.但是,当我提交表单时,在控制台中显示了一个错误,错误:不存在reCAPTCHA客户端".另外,似乎没有数据通过"g-recaptcha-response"获取,并且$ _POST ["g-recaptcha-response"]保持为空.

I've integrated reCAPTCHA v3 in one of my forms. In onload, there's a token produced and google captcha logo in the bottom right corner. But when I submit the form, in console there is an error shown, "Error: No reCAPTCHA clients exist". Also, it seems, no data is fetched by "g-recaptcha-response" and $_POST["g-recaptcha-response"] remains empty.

这是示例代码:

<script type="text/javascript">
    var ReCaptchaCallbackV3 = function() {
        grecaptcha.ready(function() {
            grecaptcha.execute("site_key").then(function(token) {
                console.log("v3 Token: " + token);
            });
        });
    };
</script>

<script src="https://www.google.com/recaptcha/api.js?onload=ReCaptchaCallbackV3&render=site_key"></script>

提交表单时,它不会产生任何"g-recaptcha-response".

It doesn't produce any "g-recaptcha-response" when the form is submitted.

我对Google reCaptcha不太了解.我遵循了他们提供的文档,并以适当的方式使用了站点和密钥.

I don't know much about google reCaptcha. I've followed the documentation provided by them and used a site and a secret key in the proper way.

有人可以告诉我问题出在哪里以及可能的解决方法是什么

Can anybody please tell me where might be the problem and what is the possible solution?

推荐答案

在发送请求之前,您是否尝试过加载脚本?

Have you tried loading the script before trying to send the request?

<script src="https://www.google.com/recaptcha/api.js?onload=ReCaptchaCallbackV3&render=site_key"></script>
<script type="text/javascript">
    var ReCaptchaCallbackV3 = function() {
        grecaptcha.ready(function() {
            grecaptcha.execute("site_key").then(function(token) {
                console.log("v3 Token: " + token);
            });
        });
    };
</script>

这篇关于错误:不存在任何reCAPTCHA客户端(reCAPTCHA v3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆