You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ilandev.AspNetCore.reCAPTCHA

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ilandev.AspNetCore.reCAPTCHA

A reCAPTCHA v3 verification client for easy token verification.

1.0.2
Source
nugetNuGet
Version published
Maintainers
1
Created
Source

ilandev.AspNetCore.reCAPTCHA

nuget.org

A simple reCAPTCHA v3 verification client for ASP.NET Core.

Usage

  • Call builder.Services.AddRecaptcha() and either pass in a configuration action to configure the middleware, or builder.Configuration to read the default configuration at the Recaptcha configuration section.

Examples

// Reads from the "Recaptcha" configuration section

builder.Services.AddRecaptcha(builder.Configuration);

// or..

builder.Services.AddRecaptcha(opts => 
{
	opts.SecretKey = "your secret key";
});

// in your controller..

public class MyController(IRecaptchaClient recaptchaClient) : ControllerBase
{
	[HttpPost("register")]
	public async Task Register([FromBody] RegisterModel model, CancellationToken cancellationToken)
	{
		var recaptchaResponse = await recaptchaClient.VerifyAsync(
			model.Token,
			HttpContext.Connection.RemoteIpAddress, // optional
			cancellationToken
		);
		
		if (!recaptchaResponse.Success)
		{
			// handle the error
		}
		
		// continue with registration
	}
}

Middleware Configuration

ConfigurationDefault ValueDetails
TokenVerifyUrlhttps://www.google.com/recaptcha/api/siteverifyThe reCAPTCHA v3 verification endpoint.
SecretKeyYour reCAPTCHA v3 secret key, found in the Google Cloud Console.
ThrowOnErrorfalseIf true, will throw a RecaptchaVerificationException when token verification fails.

Keywords

recaptcha

FAQs

Package last updated on 30 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.