Amit Sharma
Amit Sharma

Reputation: 163

How To Add More Than 50 Domains in Google Recaptcha

I am using Google Recaptcha V2 for my site and I have added 50 domains to support the Captcha on these domains. But I have more than 50 domains to add for and I can't do in google recaptcha admin. So any solutions/suggestions for this?

Upvotes: 1

Views: 2828

Answers (3)

MDH
MDH

Reputation: 132

I think you can do this more easily by following the recommendation here:

  • on your admin console, in the settings menu, untick "Verify the origin of reCAPTCHA solutions"
  • in your backend, check that the hostname in your decoded token is included in the list of domains you want to protect

Make sure however to read the security warning on the page above

Upvotes: 0

Bullsized
Bullsized

Reputation: 607

What you can do is go to the Settings of your Google Console Adminpanel and un-tick the option "Verify the origin of reCAPTCHA solutions" - that way you can use the reCAPTCHA v2 on more than 50 domains.

Upvotes: -1

Amit Sharma
Amit Sharma

Reputation: 163

After doing quite a research, I found that we simply can't add more than 50 domains per key site/secret key pair. However, we can add 50 such key pairs per google account and then create a JSON containing list of domains and its site/secret key pair like

{
   "CaptchaGroups":{
      "Group 1":{
         "CaptchaSiteKey":"group 1 site key",
         "CaptchaSecretKey":"group 1 secret key",
         "Domains":[
            "domain1.com",
            "domain2.co",
            "domain3.edu"
         ]
      },
      "Group 2":{
         "CaptchaSiteKey":"group 2 site key",
         "CaptchaSecretKey":"group 2 secret key",
         "Domains":[
            "domain4.com",
            "domain5.co",
            "domain6.edu",
            "localhost"
         ]
      }
   }
}

Then in code we can read the appropriate domain and use the site/secret key pair to use.

Upvotes: 3

Related Questions