invisible-grecaptcha
Invisible reCAPTCHA integration
Checkout the demo.
Table of Contents
Install
This project uses node and npm.
Go check them out if you don't have them locally installed.
$ npm install --save invisible-grecaptcha
The UMD build is also available on jsdelivr:
<script src="https://cdn.jsdelivr.net/npm/invisible-grecaptcha/dist/index.min.js"></script>
You can find the library on window.invisibleGrecaptcha
.
Usage
import {
createInvisibleGrecaptcha,
execute,
reset,
getResponse,
} from 'invisible-grecaptcha'
function verifyCallback(token) {
console.log(token)
}
const grecaptcha = await createInvisibleRecaptcha({
sitekey: 'RECAPTCHA_SITE_KEY',
callback: verifyCallback
})
execute(grecaptcha)
reset(grecaptcha)
getResponse(grecaptcha)
API
Table of Contents
createInvisibleGrecaptcha
Create an invisible grecaptcha and returns the id of the capctha.
Parameters
options
Object The options to create a invisible recaptcha.
Returns number
execute
Programatically invoke the reCAPTCHA check.
Parameters
recaptchaId
number Captcha id.
reset
Resets the reCAPTCHA widget.
Parameters
recaptchaId
number Captcha id.
getResponse
Gets the response for the reCAPTCHA widget.
Parameters
recaptchaId
number Captcha id.
Returns string
verifyCallback
Callback to be executed when the user submits a successful CAPTCHA response.
Type: Function
Parameters
Contributing
See the contributing file.
License
MIT License © Thiago Santos