How to use recaptcha v2 on localhost?

J.BizMai picture J.BizMai · Sep 26, 2017 · Viewed 34.4k times · Source

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

  • The owner email is the correct gmail email
  • The Site key was correct

Is there a way to test recaptcha (version 2) on Localhost (using virtualhosts) ?

Answer

J.BizMai picture J.BizMai · Sep 26, 2017

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.