https://github.com/soenneker/soenneker.blazor.turnstile
A Blazor interop library for Cloudflare Turnstile
https://github.com/soenneker/soenneker.blazor.turnstile
blazor cloudflare csharp dotnet interop turnstile
Last synced: 4 months ago
JSON representation
A Blazor interop library for Cloudflare Turnstile
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.blazor.turnstile
- Owner: soenneker
- License: mit
- Created: 2024-06-09T14:54:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-08T18:12:49.000Z (4 months ago)
- Last Synced: 2025-07-08T19:28:34.979Z (4 months ago)
- Topics: blazor, cloudflare, csharp, dotnet, interop, turnstile
- Language: C#
- Homepage: https://soenneker.com
- Size: 2.34 MB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/soenneker.blazor.turnstile/)
[](https://github.com/soenneker/soenneker.blazor.turnstile/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.blazor.turnstile/)
#  Soenneker.Blazor.Turnstile
### A Blazor interop library for Cloudflare Turnstile
This library simplifies the integration of Cloudflare Turnstile into Blazor applications, providing access to options, methods, and events. A demo project showcasing common usages is included.
Please refer to the [Cloudflare documentation](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/) for further details.
## Installation
```
dotnet add package Soenneker.Blazor.Turnstile
```
### 1. Add the following to your `Startup.cs` file
```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddTurnstileInteropAsScoped();
}
```
## Usage
```razor
@using Soenneker.Blazor.Turnstile
@code{
private readonly TurnstileOptions _options = new()
{
SiteKey = "1x00000000000000000000AA" // Testing key
};
private void OnCallback(string token)
{
// Send this token to your server for validation
Logger.LogInformation("OnCallback fired, token: {token}", token);
}
}
```
⚠️ While 95%+ of the Cloudflare Turnstile JS has been implemented, there are a few features not yet supported. If you need assistance or want to request a new feature, please open an issue or submit a pull request.