Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using reCAPTCHA on localhost

I'm developing a website using PHP and I want to make a human verification in one of the sessions. For the development, I'm initially running the system locally and when it is ready, I'm going to put it on some domain.

In the reCAPTCHA website it is said that the plugin will only work at the given domain (and subdomains).

Is there a way to use the reCAPTCHA plugin on a localhost?

like image 977
rlc Avatar asked Jul 12 '10 22:07

rlc


People also ask

Can I use reCAPTCHA in localhost?

Google doesn't support recaptcha on localhost but it can be faked. Then on google's recaptcha admin site, add to the list of site names you can add a. fake. domain-name and you should be good to go.

How do I test my localhost reCAPTCHA?

Developing and Testing reCAPTCHA on Localhost Now you should be able to open your browser and go to http://localhost:3000/your-page.html and see your reCAPTCHA token being logged out to the console. You can use something like Postman to call https://www.google.com/recaptcha/api/siteverify and verify your token.

How do you solve localhost is not in the list of supported domains for this site key?

Please go to https://www.google.com/recaptcha/admin and under settings > domains add “localhost”.


1 Answers

Update

The original answer is no longer correct. The developer's guide now states:

"If you would like to use "localhost" for development, you must add it to the list of domains."

This will only work if you access localhost using 127.0.0.1/... rather than localhost/....

The original answer is preserved below.


According to the reCAPTCHA Developer's Guide:

"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."

In other words, simply use the same key.

like image 149
Nathan Osman Avatar answered Oct 12 '22 12:10

Nathan Osman