verify-recaptcha

1.0.0 • Public • Published

verify-recaptcha

verify-recaptcha is a little library that handles the connection to the google verification backend. Features a optional proxy configuration and a promise backend.

Installation

npm i verify-recaptcha

Usage

const VerifyRecaptcha = require('verify-recaptcha')
 
let mySecret = '8673cad02e2af7ff5afc00a0b7d2b3a4951ffea74bc245bb0ee8cc7dd03f657'
let myVerification = new VerifyRecaptcha(mySecret)
 
myVerification.validate('1234545')
    .then(result => console.log('token verified!')
    .catch(error => {
        console.log('verification failed: ' + error.errorCodes.join(',')
    })

With Proxy

The constructor also accepts a proxy configuration in the following form:

{
    "host": "host",
    "port": 1337,                 //optional, defaults to 80
    "username": "myUsername",     //optional
    "password": "myPassword",     //optional, required of username has been set
    "protocol": "https"           //optional, defaults to 'http'
}
const VerifyRecaptcha = require('verify-recaptcha')
 
let mySecret = '8673cad02e2af7ff5afc00a0b7d2b3a4951ffea74bc245bb0ee8cc7dd03f657'
let myProxyConfig = {host: 'proxyHost'}
let myVerification = new VerifyRecaptcha(mySecret, myProxyConfig)
 
myVerification.validate('1234545')
    .then(result => console.log('token verified!')
    .catch(error => {
        console.log('verification failed: ' + error.errorCodes.join(',')
    })

Package Sidebar

Install

npm i verify-recaptcha

Weekly Downloads

53

Version

1.0.0

License

MIT

Last publish

Collaborators

  • thomn
  • sovrin