Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ethanent/grecaptcha

reCAPTCHA client for Node
https://github.com/ethanent/grecaptcha

javascript node nodejs npm npm-package recaptcha recaptcha-api recaptcha-verification recaptchav2

Last synced: 1 day ago
JSON representation

reCAPTCHA client for Node

Awesome Lists containing this project

README

        

# grecaptcha
> reCAPTCHA v3 / v2 client for Node

[GitHub](https://github.com/ethanent/grecaptcha) | [NPM](https://www.npmjs.com/package/grecaptcha)

## Install

```shell
npm i grecaptcha
```

## Usage in async context

```javascript
const Grecaptcha = require('grecaptcha')

const client = new Grecaptcha('secret')

if (await client.verify('token')) {
// reCAPTCHA response was accepted!
}
else {
// reCAPTCHA token denied.
}
```

## Usage in non-async context

```javascript
const client = new Grecaptcha('secret')

client.verify('token').then((accepted) => {
if (accepted) {
// reCAPTCHA response was accepted!
}
else {
// reCAPTCHA token denied.
}
}).catch((err) => {
// Request failed.
})
```