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 gonna make put it on in a certain domain.
In the reCAPTCHA website it is said that the plugin will only work at the given domain (and subdomains).
My question is: Is there any way to use the reCAPTCHA plugin on a localhost?
If you have old key, you should recreate your API Key. Also be aware of proxies.
Recaptcha will not work on
localhost/
You can write "localhost" or "127.0.0.1" but URL must be the same
Example : Google Domains Add-> localhost URL => localhost/login.php
Example : Google Domains Add-> 127.0.0.1 URL => 127.0.0.1/login.php
i got error related to recaptcha in laravel website, i resolved it by using some command and with env file and above answer will also help in this problem.
first of all check env file(in your case file which has google recaptcha key) for google recpatcha key.
second run these command :
php artisan route:clear
it will solve your problem
Update
The original answer is no longer correct. The developer's guide now states:
This will only work if you access localhost using
127.0.0.1/...
rather thanlocalhost/...
.The original answer is preserved below.
According to the reCAPTCHA Developer's Guide:
In other words, simply use the same key.
Yes, this an older question but this may be helping all the users having problems with reCaptcha on localhost. Google indeed says "By default, all keys work on 'localhost' (or '127.0.0.1')" but for real using reCaptcha on localhost may cause problems. In my case I solved mine using secure token
I posted a WORKING SOLUTION for PHP here