I'm migrating a reCAPTCHA v2 checkbox to a Google Cloud key, but the integration reports "Missing sitekey or not loaded in api.js". What should I check, and are there simpler alternatives for form spam protection?
Why does my Cloud reCAPTCHA checkbox say the site key is missing?
Answers
First, check that the key in the Cloud console is actually a challenge checkbox key, not a score-based key. Then check that the page passes that site key to the widget and loads the script intended for the integration you're using.
If you're using the Enterprise integration, that means checking enterprise.js rather than assuming the classic api.js setup applies. A data-action value such as LOGIN belongs to score-based integrations, so remove it from a checkbox widget and make sure the key type and rendering code match. The error alone doesn't prove which part is wrong, but those are useful places to start.
Reply to this answer
Cloudflare Turnstile is worth a look if you're ready to replace reCAPTCHA rather than spend more time on this migration. You'll still need to integrate and verify its responses, so it isn't necessarily a drop-in fix.
Reply to this answer
Private Captcha has a reCAPTCHA compatibility mode, which may make migration easier. Check its migration documentation against your current client and server integration before assuming a script swap is all you'll need.
Reply to this answer
A score-based key is another option if you don't specifically need a checkbox challenge. It uses a different integration, though, so switching key types without changing the corresponding code won't necessarily resolve the site key error.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions