A simple library that makes API requests to Google's Recaptcha service to confirm Recaptcha tokens.
Supports Recaptcha v2 / Invisible.
const recaptcha =
Check out the
example/ folder for a complete but minimal example.
recaptcha() returns a promise that resolves with google's reply
if the request was successful.
It fails with
typeof err === 'string' if the recaptcha api
reports a problem with the request.
- missing-input-secret: The secret parameter is missing.
- invalid-input-secret: The secret parameter is invalid or malformed.
- missing-input-response: The response parameter is missing.
- invalid-input-response: The response parameter is invalid or malformed.
- bad-request: The request is invalid or malformed.
Else the error will be an
Error object representing network error.
Here's an example response upon success:
hostname only appears on successful requests and you can use it to
ensure recaptcha submissions are originating from your domain.