This is a simple example project demonstrating how to integrate Google reCAPTCHA v3 in an ASP.NET Core MVC application. The goal is to provide a clean, minimal, and easy-to-understand implementation for bot protection.
- Integrates Google reCAPTCHA v3 without a visible checkbox
- Sends a token to the server for verification
- Validates the token using Google's API and checks the score
- Accepts the form only if the score meets the minimum threshold
Perfect for small applications or learning purposes.
Create a site here: Google reCAPTCHA Admin
Choose:
- reCAPTCHA v3
Copy:
- Site Key
- Secret Key
"Recaptcha": {
"SiteKey": "YOUR_SITE_KEY",
"SecretKey": "YOUR_SECRET_KEY",
"MinimumScore": 0.5
}dotnet restore
dotnet runOpen in browser:
http://localhost:5001
- User submits the form
- reCAPTCHA v3 generates a token asynchronously
- Token is sent to the server via a hidden field
- Server verifies token with Google API
- Google returns a score; if score >= MinimumScore → form is processed
- Do not expose your Secret Key in public repositories
- Always verify the token on the server
- Adjust
MinimumScoreaccording to your risk tolerance (default 0.5)
This project is intentionally minimal, focused, and ready to use as a demonstration or quick integration into an ASP.NET Core application.