This is a demo application that shows how to use Recaptcha Enterprise with Node.js to protect your website from spam and abuse.
- 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
- Clone the repository:
git clone https://github.com/jarooda/recaptcha-enterprise.git
- Install dependencies:
cd recaptcha-enterprise
npm install
- 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
- Copy Service Account Key file and paste in the same directory as
server.js
, rename it toservice_account_key.json
- Start the server:
npm start
-
Open your browser and go to http://localhost:3000.
-
You should see a single button. Click it to get the score.
-
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.
- 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.
This demo is licensed under the MIT license. See LICENSE file for more details.