{"id":21418723,"url":"https://github.com/benbristow/basiccaptcha","last_synced_at":"2026-05-10T10:16:55.262Z","repository":{"id":41949586,"uuid":"357279069","full_name":"benbristow/basiccaptcha","owner":"benbristow","description":"Basic minimal-dependency library to verify (re)CAPTCHA tokens.","archived":false,"fork":false,"pushed_at":"2023-08-18T20:49:08.000Z","size":32,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T16:59:35.367Z","etag":null,"topics":["captcha","csharp","dotnet","google","nuget","recaptcha"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/basiccaptcha","language":"C#","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/benbristow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"benbristow"}},"created_at":"2021-04-12T17:18:11.000Z","updated_at":"2023-08-17T23:35:07.000Z","dependencies_parsed_at":"2024-11-22T21:57:46.858Z","dependency_job_id":null,"html_url":"https://github.com/benbristow/basiccaptcha","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbristow%2Fbasiccaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbristow%2Fbasiccaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbristow%2Fbasiccaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benbristow%2Fbasiccaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benbristow","download_url":"https://codeload.github.com/benbristow/basiccaptcha/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918644,"owners_count":20368746,"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","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","csharp","dotnet","google","nuget","recaptcha"],"created_at":"2024-11-22T19:23:52.039Z","updated_at":"2026-05-10T10:16:55.213Z","avatar_url":"https://github.com/benbristow.png","language":"C#","funding_links":["https://github.com/sponsors/benbristow"],"categories":[],"sub_categories":[],"readme":"# BasicCAPTCHA\n\n[![Run unit tests](https://github.com/benbristow/basiccaptcha/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/benbristow/basiccaptcha/actions/workflows/unit-tests.yml)\n\n## Overview\n\nI created this library as I found that other NuGet libraries seem to focus a lot on integrating with ASP's bespoke\nfunctionality rather than just verifying tokens. I originally created it to use on an Azure Functions API which uses\ndependency injection, but you can use it anywhere.\n\nBasic library for verifying CAPTCHA tokens. Currently only\nsupports [Google ReCAPTCHA (V3/V2)](https://developers.google.com/recaptcha/docs/verify) which use the 'siteverify'\nendpoint to verify tokens, but I'm open to accepting pull requests for other providers if required.\n\nYou can also extend the library to support other providers by extending the `BaseProvider` class and implementing the `VerifyTokenAsync` method.\n\n## Getting Started\n\n1. Install Nuget Package\n\n```\nInstall-Package BasicCaptcha -Version 1.2.0\n```\n\n2. Register the service with your secret key in your startup file, here I'm using an environment variable. Don't\n   hardcode this secret if possible!\n\n```csharp\nbuilder.Services.AddHttpClient();  \nbuilder.Services.AddCaptcha(new GoogleRecaptchaProvider(Environment.GetEnvironmentVariable(\"GOOGLE_RECAPTCHA_SECRET\")));  \n```\n\n3. Use the service wherever you require it...\n\n```cs\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Mvc;\nusing BasicCaptcha.Contracts;\n\nnamespace Example.Controllers;\n\npublic sealed class ExampleController : Controller\n{  \n  private readonly ICaptchaService _captchaService;  \n\n  public ExampleController(ICaptchaService captchaService)  \n  {  \n      _captchaService = captchaService;  \n  }  \n    \n  public async Task\u003cIActionResult\u003e Example(string token)  \n  {  \n      var valid = await _captchaService.VerifyTokenAsync(token);\n      return valid ? Ok() : BadRequest();  \n  }  \n}  \n```\n\n## Dummy Provider\n\nIf you're doing development work, especially API development work, you probably don't want to\nhave to fill out a CAPTCHA challenge every time you hit your endpoint. So you can use the dummy provider\nto bypass the CAPTCHA challenge.\n\nTo use this you can use the dummy provider\n\n```csharp\nbuilder.Services.AddHttpClient();  \nbuilder.Services.AddCaptcha(new DummyRecaptchaProvider());  \n```\n\nIf you wish to force a failure, you can pass `fail` as the token (case-insensitive) and the `VerifyToken` method will\nalways\nreturn false instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbristow%2Fbasiccaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenbristow%2Fbasiccaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenbristow%2Fbasiccaptcha/lists"}