admin管理员组文章数量:1400195
I cant get reCAPTCHA v3 working on my website. I have put the right code in from the Google reCAPTCHA v3 website but it shows "ERROR for site owner: Invalid site key" in the bottom right.
I'm only 7 and if I have missed something, please take it easy
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recaptcha test</title>
<script src=".js"></script>
<script>
function onSubmit(token) {
document.getElementById("demo-form").submit();
}
</script>
<script src=".js?render=reCAPTCHA_site_key"></script>
<body>
<button class="g-recaptcha"
data-sitekey="reCAPTCHA_site_key"
data-callback='onSubmit'
data-action='submit'>Submit</button>
<script>
function onClick(e) {
e.preventDefault();
grecaptcha.ready(function() {
grecaptcha.execute('reCAPTCHA_site_key', {action: 'submit'}).then(function(token) {
// Add your logic to submit to your backend server here.
});
});
}
</script>
</head>
</body>
</html>
Then, I tried reCAPTCHA v2 Checkbox, same things happened. Although, "ERROR for site owner: Invalid site key" was now in the top left:
<!DOCTYPE html>?
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recaptcha test</title>
<script src=".js" async defer></script>
<script src=".js?onload=onloadCallback&render=explicit"
async defer>
</script>
<body>
<form action="?" method="POST">
<div class="g-recaptcha" data-sitekey="your_site_key"></div>
<br/>
<input type="submit" value="Submit">
</form>
<script type="text/javascript">
var onloadCallback = function() {
alert("grecaptcha is ready!");
};
</script>
</head>
</body>
</html>
I cant get reCAPTCHA v3 working on my website. I have put the right code in from the Google reCAPTCHA v3 website but it shows "ERROR for site owner: Invalid site key" in the bottom right.
I'm only 7 and if I have missed something, please take it easy
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recaptcha test</title>
<script src="https://www.google./recaptcha/api.js"></script>
<script>
function onSubmit(token) {
document.getElementById("demo-form").submit();
}
</script>
<script src="https://www.google./recaptcha/api.js?render=reCAPTCHA_site_key"></script>
<body>
<button class="g-recaptcha"
data-sitekey="reCAPTCHA_site_key"
data-callback='onSubmit'
data-action='submit'>Submit</button>
<script>
function onClick(e) {
e.preventDefault();
grecaptcha.ready(function() {
grecaptcha.execute('reCAPTCHA_site_key', {action: 'submit'}).then(function(token) {
// Add your logic to submit to your backend server here.
});
});
}
</script>
</head>
</body>
</html>
Then, I tried reCAPTCHA v2 Checkbox, same things happened. Although, "ERROR for site owner: Invalid site key" was now in the top left:
<!DOCTYPE html>?
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Recaptcha test</title>
<script src="https://www.google./recaptcha/api.js" async defer></script>
<script src="https://www.google./recaptcha/api.js?onload=onloadCallback&render=explicit"
async defer>
</script>
<body>
<form action="?" method="POST">
<div class="g-recaptcha" data-sitekey="your_site_key"></div>
<br/>
<input type="submit" value="Submit">
</form>
<script type="text/javascript">
var onloadCallback = function() {
alert("grecaptcha is ready!");
};
</script>
</head>
</body>
</html>
Share
Improve this question
asked May 29, 2020 at 10:07
user13640702user13640702
1 Answer
Reset to default 4I have tried your code of reCAPTCHA v3 which you have mentioned.
reCAPTCHA_site_key is at three places, please check if you have replaced it with correct site key under heading:
"COPY SITE KEY"
.Reason that it's showing "ERROR for site owner: Invalid site key" is you might be trying file system to access the key. It doesn't work on file systems i.e, this will not work:
file:///E:/Personal%20Data/stackoverflow/recapcha.html
Host your site on local server like IIS/Node etc, and add the same domain in domain configurations of reCAPTCHA.
For example, if your website is: https://www.testingrecapcha.
add testingrecapcha.
in domains of reCAPTCHA configurations.
To reach the admin console of reCAPTCHA, use this link and select your relevant site and click on settings icon.
本文标签: javascriptGoogle reCAPTCHA ERROR for site owner Invalid site keyStack Overflow
版权声明:本文标题:javascript - Google reCAPTCHA ERROR for site owner: Invalid site key - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744177522a2594071.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论