6

How can I use Google's reCAPTCHA in a test server on a local network?

According to the documentation:

By default, all keys work on "localhost" (or "127.0.0.1"), so you can always develop and test on your local machine.

My virtual machines however are located on non-localhost local IPs (192.168.XXX.XXX), and adding "localhost" or "127.0.0.1" does not seem to work (the captcha displays an invalid domain error). Is there any way around this?

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
Mahn
  • 16,261
  • 16
  • 62
  • 78

3 Answers3

10

You can enter a local IP such as 192.168.0.1 into the admin console and will indeed work (you'll have to wait a few minutes for it to apply).

Unfortunately it is limited to only 50 domains so this may not be a solution.

Drew Harwell
  • 134
  • 2
  • 6
6

Beside adding the local IP to the admin console (as Drew suggested) enter image description here

you can also (temporarily) disable the origin validation.

go to the admin console

Advanced Settings -> uncheck "Verify the origin of reCAPTCHA solutions"

Verify the origin of reCAPTCHA solutions

Note: If disabled in production - you are required to check the hostname on your server when verifying a solution.

ET-CS
  • 6,334
  • 5
  • 43
  • 73
1

steps to use reCAPTCHA on localhost :

  1. go to reCAPTCHA admin
  2. click (+) Create
  3. set label to localhost
  4. choose the type of reCAPTCHA you want to use choose
  5. and set the domain name to localhost, also allow the reCAPTCHA Terms of Service allow