- Added this script - <script src='https://www.google.com/recaptcha/api.js?render=<my-site-key>'></script>
- Executed this code after the script has loaded:
grecaptcha.ready(function() {
grecaptcha.execute('<my-site-key>', {action: 'action_name'})
.then(function(token) {
console.log(token)
});
});
The console.log statement doesn't print anything in step 2. But when I remove the second parameter { action: 'Page Load' }, from the grecaptcha.execute method, I get a token in my console.
Why is this happening?
The docs don't talk about adding actions anywhere but the directly in the code.
Do I need to configure these actions somewhere before using them in the code?