captchahcaptcha

Use and test hCaptcha on localhost


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


Solution

  • 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

    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.