Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 2 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 (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-29T12:59:23.000Z (2 months ago)
- Last Synced: 2024-10-31T10:51:44.684Z (2 months ago)
- Topics: blazor, cloudflare, csharp, dotnet, interop, turnstile
- Language: C#
- Homepage: https://soenneker.com
- Size: 754 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![](https://img.shields.io/nuget/v/soenneker.blazor.turnstile.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.blazor.turnstile/)
[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.blazor.turnstile/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.blazor.turnstile/actions/workflows/publish-package.yml)
[![](https://img.shields.io/nuget/dt/soenneker.blazor.turnstile.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.blazor.turnstile/)# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) Soenneker.Blazor.Turnstile
### A Blazor interop library for Cloudflare TurnstileThis 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.AddTurnstile();
}
```## 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.