I am getting the following error in Google Recaptcha V3 on my website.
ERROR for site owner: Invalid key type
I am using following method to verify captcha:
- adding script
<script src="https://www.google.com/recaptcha/api.js?render=API_KEY"></script>
- on submit verify:
$('.submit-e-way-bill-registration').on('submit', function (e) {
e.preventDefault();
var self = this;
if ($(self)[0].checkValidity()) {
grecaptcha.ready(function () {
grecaptcha.execute('API_KEY', {
action: 'homepage'
}).then(function (token) {
console.log(token);
console.log('google captcha initiated');
$('[name=captcha_token]').val(token);
var data = $(self).serialize();
$('.save-button-ewb').prop('disabled', true);
$.post('/api/submit-e-way-bill-registration.php', data, function (result) {
$('.save-button-ewb').prop('disabled', false);
console.log('status');
if (result.status == 'success') {
$('.success-message').show();
$('.submit-e-way-bill-registration').hide();
} else {
$('.error-message').show();
$('.submit-e-way-bill-registration').hide();
}
});
});
});
}
});
This used to work before (about 3-4 months ago) this way. Now when I am checking I am getting the above error.
Can anyone tell me what is wrong in the code???