How can I test hCaptcha on localhost?
When using the key, I get a CORS error, and for choosing sites for the key, it specifically states ... localhost will not work
... localhost will not work
There are test keys you should use for testing, see https://docs.hcaptcha.com/#integration-testing-test-keys
Referenced Below:
Test Key Set: Publisher Account Test parameter Value Site Key 10000000-ffff-ffff-ffff-000000000001 Secret Key 0x0000000000000000000000000000000000000000 Test Key Set: Enterprise Account (Safe End User) Test parameter Value Site Key 20000000-ffff-ffff-ffff-000000000002 Secret Key 0x0000000000000000000000000000000000000000 Test Key Set: Enterprise Account (Bot Detected) Test parameter Value Site Key 30000000-ffff-ffff-ffff-000000000003 Secret Key 0x0000000000000000000000000000000000000000
Test Key Set: Publisher Account
Test parameter Value
Site Key 10000000-ffff-ffff-ffff-000000000001 Secret Key 0x0000000000000000000000000000000000000000
10000000-ffff-ffff-ffff-000000000001
0x0000000000000000000000000000000000000000
Test Key Set: Enterprise Account (Safe End User)
Site Key 20000000-ffff-ffff-ffff-000000000002 Secret Key 0x0000000000000000000000000000000000000000
20000000-ffff-ffff-ffff-000000000002
Test Key Set: Enterprise Account (Bot Detected)
Site Key 30000000-ffff-ffff-ffff-000000000003 Secret Key 0x0000000000000000000000000000000000000000
30000000-ffff-ffff-ffff-000000000003
PS: I confirmed this with the hCaptcha team.
PSS: A different work around would be use change your hosts file to point your-website.com to localhost to do testing.
hosts
your-website.com
in the browser replace localhost to 127.0.0.1
https://i.stack.imgur.com/tDsPW.png
There are test keys you should use for testing, see https://docs.hcaptcha.com/#integration-testing-test-keys
Referenced Below:
PS: I confirmed this with the hCaptcha team.
PSS: A different work around would be use change your
hosts
file to pointyour-website.com
to localhost to do testing.