reCAPTCHA Enterprise Setup Guide
This guide will help you set up complete reCAPTCHA Enterprise verification for your contact form.
🔑 Required API Keys
You need two keys from Google:
1. reCAPTCHA Site Key (Public)
- Current value:
6Le2g6crAAAAABrTyFxjbc5sCYhgnUs0Nnxuicw - Used for: Frontend reCAPTCHA widget
- Where: Already configured in your reCAPTCHA admin
2. Google Cloud API Key (Private)
- Used for: Backend verification with Google’s API
- Where to get: Google Cloud Console
🚀 Getting Your Google Cloud API Key
Step 1: Enable reCAPTCHA Enterprise API
- Go to Google Cloud Console
- Select project:
build-tales-cont-1755298987457 - Go to APIs & Services > Library
- Search for “reCAPTCHA Enterprise API”
- Click Enable
Step 2: Create API Key
- Go to APIs & Services > Credentials
- Click + CREATE CREDENTIALS > API Key
- Copy the generated API key
- Restrict the key (recommended):
- Click on the key to edit
- Under “API restrictions”, select “Restrict key”
- Choose “reCAPTCHA Enterprise API”
- Save
🔧 Environment Setup
For Local Development
export RECAPTCHA_SITE_KEY="6Le2g6crAAAAABrTyFxjbc5sCYhgnUs0Nnxuicw"
export GOOGLE_RECAPTCHA_API_KEY="your_api_key_here"
For Netlify Production
Add these environment variables in Netlify dashboard:
- Go to your Netlify site dashboard
- Navigate to Site settings > Environment variables
- Add:
RECAPTCHA_SITE_KEY=6Le2g6crAAAAABrTyFxjbc5sCYhgnUs0NnxuicwGOOGLE_RECAPTCHA_API_KEY=your_api_key_here
For GitHub Pages (Alternative)
If using GitHub Pages, add these secrets:
- Go to repository Settings > Secrets and variables > Actions
- Add:
RECAPTCHA_SITE_KEY=6Le2g6crAAAAABrTyFxjbc5sCYhgnUs0NnxuicwGOOGLE_RECAPTCHA_API_KEY=your_api_key_here
🧪 Testing the Setup
Local Testing
- Set environment variables
- Run Jekyll:
bundle exec jekyll serve - Visit:
http://localhost:4000/about/ - Fill out and submit the contact form
- Check browser console for any errors
Production Testing
- Deploy to Netlify with environment variables set
- Test the contact form on your live site
- Check Netlify function logs for verification results
🔍 How It Works
- User submits form → reCAPTCHA Enterprise generates token
- Frontend sends → Token + form data to
/.netlify/functions/verify-recaptcha - Serverless function → Verifies token with Google’s API
- If verified → Forwards form data to Formspree
- Success response → User sees confirmation message
🛠 Troubleshooting
Common Issues
“API key not found”
- Ensure
GOOGLE_RECAPTCHA_API_KEYis set in Netlify environment variables
“reCAPTCHA verification failed”
- Check that your site key matches in both frontend and backend
- Verify the API key has reCAPTCHA Enterprise API enabled
“CORS errors”
- The Netlify function handles CORS automatically
- Ensure you’re testing on the correct domain
Debug Mode
Add this to your Netlify function logs:
console.log('reCAPTCHA verification result:', result);
📋 Security Checklist
- ✅ API key is restricted to reCAPTCHA Enterprise API only
- ✅ Site key is domain-restricted in reCAPTCHA admin
- ✅ Environment variables are set in Netlify (not in code)
- ✅ Form submission goes through verification endpoint
- ✅ Proper error handling for failed verifications
🎯 Next Steps
- Get your Google Cloud API key
- Add it to Netlify environment variables
- Deploy and test the contact form
- Monitor Netlify function logs for any issues
Your reCAPTCHA Enterprise setup will then be complete! 🎉