{"id":20989568,"url":"https://github.com/fereidani/recaptcha2","last_synced_at":"2025-07-28T08:07:13.336Z","repository":{"id":36478869,"uuid":"40784427","full_name":"fereidani/recaptcha2","owner":"fereidani","description":"Easy verifier for google reCAPTCHA version 2 for Node.js and Express.js","archived":false,"fork":false,"pushed_at":"2021-10-30T03:05:44.000Z","size":28,"stargazers_count":48,"open_issues_count":1,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-24T15:08:58.878Z","etag":null,"topics":["captcha","form-validation","google","google-recaptcha","nodejs","recaptcha","recaptcha-api"],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fereidani.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-15T20:52:32.000Z","updated_at":"2022-12-28T19:54:30.000Z","dependencies_parsed_at":"2022-08-29T14:01:22.811Z","dependency_job_id":null,"html_url":"https://github.com/fereidani/recaptcha2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fereidani/recaptcha2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fereidani%2Frecaptcha2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fereidani%2Frecaptcha2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fereidani%2Frecaptcha2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fereidani%2Frecaptcha2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fereidani","download_url":"https://codeload.github.com/fereidani/recaptcha2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fereidani%2Frecaptcha2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267070324,"owners_count":24030970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["captcha","form-validation","google","google-recaptcha","nodejs","recaptcha","recaptcha-api"],"created_at":"2024-11-19T06:25:23.624Z","updated_at":"2025-07-28T08:07:13.311Z","avatar_url":"https://github.com/fereidani.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reCAPTCHA2\nEasy verifier for Google reCAPTCHA version 2 for Node.js\n\n## How to use\n\n### Step 1: Setup reCAPTCHA on your site\n\nYou need to receive your site key and secret key for your domain from https://www.google.com/recaptcha/intro/.\n\nFollow the steps on this page to include the reCAPTCHA on your website.\n\n### Step 2: Initialize verifier\n```js\nvar reCAPTCHA = require('recaptcha2');\n\nvar recaptcha = new reCAPTCHA({\n  siteKey: 'your-site-key', // retrieved during setup\n  secretKey: 'your-secret-key', // retrieved during setup\n  ssl: false // optional, defaults to true.\n             // Disable if you don't want to access\n             // the Google API via a secure connection\n});\n```\n\n### Step 3: Verifying the reCAPTCHA response\n\nreCAPTCHA2 uses promises to validate the reCAPTCHA response, you can use one of the following methods:\n* please mention on catch, library passes error codes from google which you can translate with translateErrors method\n\n#### Simple usage:\n```js\nrecaptcha.validate(key)\n  .then(function(){\n    // validated and secure\n  })\n  .catch(function(errorCodes){\n    // invalid\n    console.log(recaptcha.translateErrors(errorCodes)); // translate error codes to human readable text\n  });\n```\n**Optional:** You can also pass the clients IP address to the validate method after the key. For more information on that, please see the [reCAPTCHA documentation](https://developers.google.com/recaptcha/docs/verify).\n\n#### For use with Express (you need body-parser):\n```js\nfunction submitForm(req, res) {\n  recaptcha.validateRequest(req)\n    .then(function(){\n      // validated and secure\n      res.json({formSubmit:true})\n    })\n    .catch(function(errorCodes){\n      // invalid\n      res.json({\n        formSubmit: false,\n        errors: recaptcha.translateErrors(errorCodes) // translate error codes to human readable text\n      });\n    });\n}\n```\n\n### Generating the reCAPTCHA widget\n\n`recaptcha.formElement()` returns standard form element for reCAPTCHA which you should include at the end of your html form element.\n\nYou can also set CSS classes like this: `recaptcha.formElement('custom-class-for-recaptcha')`.\nThe default class is `g-recaptcha`.\n\n```html\n\u003cdiv class=\"custom-class-for-recaptcha\" data-sitekey=\"your-site-key\"\u003e\u003c/div\u003e\n```\n\n## Changelog\n\nPlease see the [CHANGELOG.md](CHANGELOG.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffereidani%2Frecaptcha2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffereidani%2Frecaptcha2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffereidani%2Frecaptcha2/lists"}