# 🚀 Kavez.PKCE.Api
**Secure PKCE API for OAuth 2.0 flows — built with ASP.NET Core and powered by Kavez.PKCE NuGet package**
---
## 🔐 What is this?
`Kavez.PKCE.Api` is a modular, educational Web API that demonstrates how to implement and test PKCE (Proof Key for Code Exchange) in OAuth 2.0 flows.
It’s designed for developers, educators, and teams building secure authentication systems across mobile, desktop, CLI, and web platforms.
This API wraps the core functionality of the [`Kavez.PKCE`](https://www.nuget.org/packages/Kavez.PKCE) NuGet package and exposes it via HTTP endpoints.
---
## 📡 API Endpoints
### `GET /api/pkce?method=S256`
Generates a PKCE code verifier and challenge.
**Query Parameters:**
- `method`: `S256` (default) or `plain`
**Response:**
```json
{
"verifier": "randomly-generated-string",
"challenge": "base64url-encoded-SHA256",
"method": "S256"
}Verifies that a given code_verifier matches the expected code_challenge.
Request Body:
{
"verifier": "original-verifier",
"challenge": "received-challenge",
"method": "S256"
}Response:
{
"isValid": true
}Simulates token issuance for educational purposes.
Request Body:
{
"code": "auth-code",
"redirectUri": "https://localhost:5001/callback",
"clientId": "demo-client",
"codeVerifier": "original-verifier"
}Response:
{
"access_token": "generated-guid",
"token_type": "Bearer",
"expires_in": 3600
}Returns a full PKCE flow sample including authorization URL.
Response:
{
"verifier": "...",
"challenge": "...",
"redirect_uri": "https://localhost:5001/callback",
"client_id": "demo-client",
"authorization_url": "https://auth.example.com/authorize?...params..."
}- ✅ Learn how PKCE works in practice
- ✅ Test your OAuth clients with real PKCE values
- ✅ Simulate token flows without needing a full auth server
- ✅ Use as a reference implementation for secure API design
git clone https://github.com/mgolikhatir/Kavez.PKCE.Api.git
dotnet restore
dotnet runOpen Swagger UI at:
https://localhost:5001/swagger
- .NET 8
Kavez.PKCESwashbuckle.AspNetCorefor Swagger UI
Developed by Mohammad Golikhatir
Founder & CEO of Kavez — building modular, secure, and globally scalable tools for developers, educators, and innovators.
📬 For feedback, collaboration, or workshops:
Connect via LinkedIn or explore more projects on GitHub
MIT © Mohammad Golikhatir
Feel free to use, fork, and contribute.