I need to integrate recaptcha v3 with my jsp site. It's just a login page which is sending data to another endpoint after clicking Login button. FOr PoC I was able to add recaptcha on page and get token when page is load. Then I was able to verify it.
I would like now to get token and verify it at the moment when user click Login button. So I add onclick event on button and assign my function there:
function verifyCaptcha() {
grecaptcha.ready(function() {
grecaptcha.execute('sitekey', {action: 'submit'}).then(function (token) {
checkCaptcha(token);
});
});
}
But after I click Login it doesn't go inside grecaptcha.ready function. What I did wrong here?