DEV Community

Cover image for How to use Captcha on localhost?
Hardique Dasore
Hardique Dasore

Posted on • Updated on

How to use Captcha on localhost?

According to the Google’s developer guide, localhost domains are not supported by default due to which you will get the following error on captcha:

“Localhost is not in the list of supported domains”

In order to access captcha on your localhost, you need to add them to the list of supported domains for your site key.

Follow the steps below to remove the above mentioned error:

  1. Go to the reCAPTCHA Enterprise console or to the reCAPTCHA console.
  2. Click on the Settings icon (⚙️).
  3. Scroll down to domains section.
  4. In the Add a domain input section, add localhost and press enter. (localhost:4200, 127.0.0.1:4200 and http://localhost:4200 all are invalid formats, only use localhost)
  5. Click SAVE.

Optional: if you are using 127.0.0.1 instead of localhost, add 127.0.0.1 too.

Once you refresh your webpage, you will be able to access captcha on localhost. You can now use it to develop and test your web application.
It is recommended to use separate keys for development and production, where you can use development site key on your local.

Image description

Follow us on Instagram

Top comments (1)

Collapse
 
blinkosh profile image
Blinkosh

Thank you for the helpful information