Handles Google reCaptcha verification asynchronously.
npm i -S async-recaptcha
const asyncRecaptcha = require("async-recaptcha"),
secret = "your google reCaptcha secret key";
// this example uses express/body-parser to get the g-captcha-response string
asyncRecaptcha(req.body['g-recaptcha-response'], secret)
.then(function() {
// success
})
.catch(function(error) {
// fail
console.log(error);
});
asyncRecaptcha(captchaResponse, secret)
Validate Google reCaptcha
Name | Type | Description |
---|---|---|
captchaResponse | string | 'g-captcha-response' |
secret | string | your Google reCaptcha secret string |
Promise