How to use recaptcha v2 on localhost?

I found this solution.

Using these keys below, you can do your tests on localhost, these keys are provided in the above link for testing purposes by google:

Site key: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
Secret key: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

Google adds a message on recaptcha to prevent users and the administrator that keys are just for tests.


You can also put localhost and 127.0.0.1 into your site admin. From the faqs: https://developers.google.com/recaptcha/docs/faq#im-getting-an-error-localhost-is-not-in-the-list-of-supported-domains-this-was-working-before-what-should-i-do

localhost domains are no longer supported by default. If you wish to continue supporting them for development you can add them to the list of supported domains for your site key. Go to the admin console to update your list of supported domains. We advise to use a separate key for development and production and to not allow localhost on your production site key.