Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.85 KB

README.md

File metadata and controls

60 lines (39 loc) · 1.85 KB

recaptcha-enterprise

This is a demo application that shows how to use Recaptcha Enterprise with Node.js to protect your website from spam and abuse.

Prerequisites

  • Node.js installed on your machine
  • A Google Cloud project with Recaptcha Enterprise API enabled
  • Recaptcha Enterprise API key
  • Service Account Key in .json format with reCAPTCHA Enterprise Agent role

Installation

  1. Clone the repository:
git clone https://github.com/jarooda/recaptcha-enterprise.git
  1. Install dependencies:
cd recaptcha-enterprise
npm install
  1. Create a .env file and set your Recaptcha Enterprise API key and secret key:
RECAPTCHA_SITE_KEY=your_recaptcha_site_key
RECAPTCHA_THRESHOLD=your_recaptcha_threshold
PROJECT_ID=your_project_id
  1. Copy Service Account Key file and paste in the same directory as server.js, rename it to service_account_key.json

Usage

  1. Start the server:
npm start
  1. Open your browser and go to http://localhost:3000.

  2. You should see a single button. Click it to get the score.

  3. If the Recaptcha score is above threshold, it will show green ribbon. If the score below threshold, it will show red ribbon and the button is disabled.

Notes

  • This demo uses the @google-cloud/recaptchaenterprise package to interact with Recaptcha Enterprise API.
  • The demo includes a simple Express.js server and a HTML templates to illustrate how to integrate Recaptcha Enterprise with your website.
  • This is a demo and not intended for production use. Please make sure to follow best practices and guidelines when implementing Recaptcha Enterprise in your production environment.
  • For more information, refer to reCAPTCHA Enterprise docs.

License

This demo is licensed under the MIT license. See LICENSE file for more details.