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?
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.
Beside adding the local IP to the admin console (as Drew suggested)
you can also (temporarily) disable the origin validation.
go to the admin console
Advanced Settings -> uncheck "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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With