@zaneray/recaptcha-node
v3.0.0
Published
Wraps Recaptcha validation to a true/false
Downloads
61
Maintainers
Keywords
Readme
ZaneRay Recaptcha
- turns recaptcha api call into a boolean
Requirements
- understanding of Recaptcha https://www.google.com/recaptcha/about/
Usage
in your node project
npm install --save @zaneray/recaptcha-nodein your application code
const Recaptcha = require('@zaneray/recaptcha-node');
//score ranges from 0 - 1.0 - lower numbers are more prone to be bots
const recaptcha = new Recaptcha(process.env.RECAPTCHA_SITE_KEY,
process.env.RECAPTCHA_MINUMUM_SCORE
process.env.RECAPTCHA_ACTION);
if (recaptcha.verify(req.body['g-recaptcha-response'])) {
//likely not a bot, continue
} else {
//likely a bot, handle this case elegantly so real users are not angry
}