Reputation: 2787
Using the Google recaptcha version 2 for my wordpress, I added the "localhost" domain (I tried "127.0.0.1" as well) on my google account side and I got keys but on my client-side I got this error :
ERROR: Invalid domain for site key
Is there a way to test recaptcha (version 2) on Localhost (using virtualhosts) ?
Upvotes: 18
Views: 55047
Reputation: 2787
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.
Upvotes: 90
Reputation: 403
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.
Upvotes: 5