Discuss Scratch
- Discussion Forums
- » Things I'm Making and Creating
- » How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
- 46009361
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
First, go to the Google reCAPTCHA Admin Console and log in to your Google account or create one if you haven't already. This assumes you aren't logged in.
Fill out the form and select reCAPTCHA v2. You must also select the “I'm not a robot” Checkbox option.
Enter the domains and any other necessary information in the form. For a localhost domain such as localhost:8080, type localhost.
You are given a site key and a secret key. The webpage should be in HTML5. The following code should be placed anywhere in the page:
Replace your_site_key with the site key that was given. You can always refer to it later.
Once the form is submitted, the browser must execute a PHP script that does the following:
Check if it is a POST request. If so, do this:
First, get the value of the POST parameter g-recaptcha-response.
Next, send a POST request to https://www.google.com/recaptcha/api/siteverify with the parameter secret as the secret key that was provided earlier (like the site key, you can always check it later) and the parameter response as the value received earlier for the POST parameter g-recaptcha-response.
Once the request is received, decode it into/parse it as a JSON object.
Finally, check the JSON object parsed just earlier and check if the value of the parameter success in the object equals true. If so, the reCAPTCHA is solved!
Fill out the form and select reCAPTCHA v2. You must also select the “I'm not a robot” Checkbox option.
Enter the domains and any other necessary information in the form. For a localhost domain such as localhost:8080, type localhost.
You are given a site key and a secret key. The webpage should be in HTML5. The following code should be placed anywhere in the page:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>The following code should be placed in the body of the document inside a form with a POST method.
<div class=“g-recaptcha” data-sitekey="your_site_key"></div>I apologize for the quotes around g-recaptcha looking like “ and ” instead of “ and ” (Oh, these quotes got changed too).
Replace your_site_key with the site key that was given. You can always refer to it later.
Once the form is submitted, the browser must execute a PHP script that does the following:
Check if it is a POST request. If so, do this:
First, get the value of the POST parameter g-recaptcha-response.
Next, send a POST request to https://www.google.com/recaptcha/api/siteverify with the parameter secret as the secret key that was provided earlier (like the site key, you can always check it later) and the parameter response as the value received earlier for the POST parameter g-recaptcha-response.
Once the request is received, decode it into/parse it as a JSON object.
Finally, check the JSON object parsed just earlier and check if the value of the parameter success in the object equals true. If so, the reCAPTCHA is solved!
Last edited by 46009361 (April 24, 2021 00:26:48)
- Capitan_Florida_2
-
100+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
what does this have to do with scratch
- 46009361
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
I meant to put it here: https://scratch.mit.edu/discuss/30/
- MegaApuTurkUltra
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
i'd advise against using google recaptcha
it's basically mandatory user tracking for google, and it forces people to do unpaid image recognition work to train google AI (in other words, slave labor)
even worse, it fundamentally bars people who may be disabled from using your website, because in my experience clicking the “audio captcha” button always gives some generic error
many, many other captcha solutions exist that aren't literally the definition of evil
it's basically mandatory user tracking for google, and it forces people to do unpaid image recognition work to train google AI (in other words, slave labor)
even worse, it fundamentally bars people who may be disabled from using your website, because in my experience clicking the “audio captcha” button always gives some generic error
many, many other captcha solutions exist that aren't literally the definition of evil
- xn--cr8h
-
48 posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
99% of problems that recaptcha tries to solve can also be solved by rolling your own captcha that isn't hopelessly overengineered
- LastContinue
-
500+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
I personally like to force users to mine 1000 valid shares of Monero before letting them past, as a time delay system, but also means if anyone then goes to the lengths of trying to bruteforce my systems at an efficient speed, they are compensating me in the process, even if they don't get in. 99% of problems that recaptcha tries to solve can also be solved by rolling your own captcha that isn't hopelessly overengineered
Shame how Coinhive shut down.
i'd advise against using google recaptcha
it's basically mandatory user tracking for google, and it forces people to do unpaid image recognition work to train google AI (in other words, slave labor)
even worse, it fundamentally bars people who may be disabled from using your website, because in my experience clicking the “audio captcha” button always gives some generic error
many, many other captcha solutions exist that aren't literally the definition of evil
How do you feel about hcaptcha? (Apart from the fact it looks like a full on scam of course

- game_pr0grammer
-
500+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
basically mandatory user tracking for google, and it forces people to do unpaid image recognition work to train google AI (in other words, slave labor)
What do you mean “unpaid”? It does pay you–access to something.
- Sheep_maker
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
Slaves were also paid food and shelter; the difference is that normal work is voluntarybasically mandatory user tracking for google, and it forces people to do unpaid image recognition work to train google AI (in other words, slave labor)
What do you mean “unpaid”? It does pay you–access to something.
- LastContinue
-
500+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
'Tisn't Google giving the access, but rather the site owner.basically mandatory user tracking for google, and it forces people to do unpaid image recognition work to train google AI (in other words, slave labor)
What do you mean “unpaid”? It does pay you–access to something.
That would be like saying slaves are paid because international charities provide them with basic living necessities…
- 46009361
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
Well, you only need
<script src="https://www.google.com/recaptcha/api.js" async defer></script>and a variation of
<div class=“g-recaptcha” data-sitekey=“6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI”></div>
- LastContinue
-
500+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
Yes but you're still giving your visitors information - most of who will be none-the-wiser - to the Anti-Consumer MegaCorp that is Alphabet Inc. Well, you only need<script src="https://www.google.com/recaptcha/api.js" async defer></script>and a variation of<div class=“g-recaptcha” data-sitekey=“6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI”></div>
Last edited by Paddle2See (April 24, 2021 02:05:52)
- MegaApuTurkUltra
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
also this is kind of a tangent but i think having automatic registration on your site is a bad idea in general
i'm more for models where humans manually review each registration, or your site is just entirely invite-only
i'm more for models where humans manually review each registration, or your site is just entirely invite-only
- 46009361
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
Bump. 

- Saturates
-
100+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
A bump after 2 years?? Bump.
- 46009361
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
Yeah! Looks like a Scratch Team member moved it to the right forum; this was originally in Advanced Topics.A bump after 2 years?? Bump.
- mythic_mew
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
this is for video games and books?!?!?!?!?!?Yeah! Looks like a Scratch Team member moved it to the right forum; this was originally in Advanced Topics.A bump after 2 years?? Bump.
- 46009361
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
Bump. 

- DifferentDance8
-
1000+ posts
How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site
Reported this to move either to the ATs again, or to TiMaC. This subsection is for movies, TV shows, books, and other things (code not being one of them)
- Discussion Forums
- » Things I'm Making and Creating
-
» How to add reCAPTCHA v2 "I'm not a robot" checkbox to your site