Files
structured-website-builder-…/tasks-workflows/2026-06-08-recaptcha-v2-prep.md
T

78 lines
2.1 KiB
Markdown
Raw Normal View History

2026-06-09 11:57:54 -06:00
# iNDX reCAPTCHA v2 Prep - 2026-06-08
## Context
During the paddleNET launch, the contact form initially used the wrong reCAPTCHA key type. The visible checkbox widget requires a classic reCAPTCHA v2 checkbox key, not an Enterprise/score-style key.
The same correction was prepared for iNDX so the future iNDX contact form work can use the correct key type.
## Key Lesson
If the page uses this classic checkbox widget:
```html
<div class="g-recaptcha" data-sitekey="..."></div>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
```
then the Google key must be:
```text
reCAPTCHA v2 checkbox
```
Do not use a key whose integration instructions show:
```text
grecaptcha.enterprise.execute(...)
```
That is the Enterprise/action-score style flow and requires different frontend and backend verification code.
## Error Seen On paddleNET
```text
ERROR for site owner: Invalid key type
```
Root cause:
- Frontend widget expected v2 checkbox.
- Site key was not v2 checkbox.
## iNDX Action Completed
A new v2 checkbox key was created for iNDX and the old v3-style key was removed/replaced in Google reCAPTCHA management.
Secrets should not be committed to this repo. Only the public site key belongs in HTML/source. The secret key belongs in the production server env file.
## Implementation Pattern For iNDX
Frontend source should use the public site key:
```html
<div class="g-recaptcha" data-sitekey="<indx-v2-checkbox-site-key>"></div>
```
Backend env should use the private secret:
```bash
RECAPTCHA_SECRET_KEY=<indx-v2-checkbox-secret-key>
```
Backend verification can use classic siteverify:
```text
https://www.google.com/recaptcha/api/siteverify
```
## Future Similar Task Checklist
1. Decide which reCAPTCHA integration the code uses.
2. For visible checkbox, create/select reCAPTCHA v2 checkbox key.
3. Add both root and www domains.
4. Put public site key in HTML/source.
5. Put secret key only in server env.
6. Restart backend after changing secret.
7. Hard refresh browser and test the widget.
8. Submit a real form to confirm backend verification succeeds.