Switch from reCAPTCHA to hCaptcha
Switching from reCAPTCHA to hCaptcha is easy. Below you can find a step-by-step guide to help with this upgrade.
You don't have to update your callbacks or tag attributes. hCaptcha is API-compatible with reCAPTCHA.
Get your hCaptcha sitekey and secret key
- Signup or login on the hCaptcha Dashboard
- Go to the Sites tab in the dashboard and create a new sitekey.
- Go to the Settings tab in the dashboard and generate your secret key by clicking
Generate New Secret
.
Update client side integration
Replace the script tag:
<script src="https://www.google.com/recaptcha/api.js"
async defer></script>becomes
<script src="https://js.hcaptcha.com/1/api.js"
async defer></script>Replace the parameter name:
g-recaptcha
becomesh-captcha
Update server side integration
Update secret key:
Use the secret key that you got in the first step.
Replace field used from the form:
g-recaptcha-response
becomesh-captcha-response
Update siteverify URL
https://www.google.com/recaptcha/api/siteverify
(orhttps://www.recaptcha.net/recaptcha/api/siteverify
) becomeshttps://api.hcaptcha.com/siteverify
Invert score consumption (reCAPTCHA v3 or Enterprise to hCaptcha Enterprise only)
reCAPTCHA scores run from 0.0 (bot) to 1.0 (person). hCaptcha Enterprise scores are risk scores, and thus they run from 0.0 (no risk) to 1.0 (confirmed threat). See the hCaptcha Enterprise documentation on scores for more details. (Requires login to Enterprise account.) This means you should invert any score checks in your score consumption code.
If (score < threshold) Then [mitigate]
becomes
If (score >= threshold) Then [mitigate]
Switch from plugins/libraries
pre-built hCaptcha integrations are available for virtually all platforms and frameworks. A few are linked below:
Platform/Framework | Link |
---|---|
ReactJS | react-hcaptcha |
Angular | ng-hcaptcha |
Android | Android SDK |
iOS | iOS SDK |
Express.js | express-hcaptcha |
Node.js | node-hcaptcha |
VueJS | vue-hcaptcha |
WordPress plugin | hcaptcha-wordpress-plugin |
PHP | Use hCaptcha with PHP Apps |