This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
make # Regenerate Kiota files from OpenAPI specs + build (requires GODESCOPE env var)
make dotnet-build # Build without regenerating Kiota files (faster, no side effects, recommended if you don't need to generate Kiota files)
make test-quick # Run unit tests on net8.0 only (recommended during development)
make test # Run unit tests across all frameworks (net6.0, net8.0, net9.0, net10.0)
make cover # Run tests with coverage report (net8.0)
make clean # Clean build artifactsTo build without regenerating Kiota files: cd Descope && dotnet build
To run a single test: cd Descope.Test && dotnet test --framework net8.0 --filter "FullyQualifiedName~TestClassName.TestMethodName"
This is the Descope .NET SDK — a Kiota-generated API client for Descope's authentication and management APIs, published as the Descope NuGet package. It targets netstandard2.0, net6.0, net8.0, net9.0, and net10.0.
- Descope/ — The SDK library
- Descope.Test/ — xUnit tests (Moq + FluentAssertions)
- Descope.Example.WebApp/ — ASP.NET OIDC example app
Descope/Generated/Mgmt/andDescope/Generated/Auth/— Auto-generated by Kiota. Never edit manually. Regenerated bymake generate.Descope/Sdk/— Hand-written SDK code (client wrappers, extensions, middleware, factories).
IDescopeClient / DescopeClient wraps two Kiota-generated clients:
client.Mgmt.V1/client.Mgmt.V2— Management API (wrapsDescopeMgmtKiotaClient)client.Auth.V1— Auth API (wrapsDescopeAuthKiotaClient)client.Auth.ValidateSessionAsync()/RefreshSessionAsync()— JWT token operations
Two creation paths: DescopeManagementClientFactory.Create(options) (instance-based) or services.AddDescopeClient(options) (DI).
Extension methods in AuthExtensions.cs and MgmtExtensions.cs wrap Kiota-generated methods with cleaner APIs:
PostWithJwtAsync/GetWithJwtAsync— Auth operations requiring a refresh JWTPostWithKeyAsync— Operations requiring an access keyGetWithIdAsync/GetWithTenantIdAsync/GetWithIdentifierAsync— Management lookupsPostWithSettingsResponseAsync/PostWithJsonOutputAsync— Typed response helpers
When adding extension methods:
- Make implicit requirements (JWTs, IDs) explicit in method signatures
- Validate parameters and throw
DescopeException - Include XML docs with examples
- Always add an entry to
Obsolete.csvto mark the wrapped generated method as obsolete (format:RelativeFilePath,Method,Replacement)
Custom DelegatingHandler implementations in Descope/Sdk/Internal/Middleware/:
- CookieToBodyHandler — Extracts JWTs from
Set-Cookieheaders (DS/DSR) into the response body for "Manage in cookies" mode - FixRootResponseBodyHandler — Corrects OpenAPI response body nesting inconsistencies
- FgaCacheUrlHandler — Routes specific FGA POST operations to an alternate cache URL
- DescopeErrorResponseHandler — Error response handling
When adding middleware, register it in both DescopeClientFactory.cs and DescopeServiceCollectionExtensions.cs.
Descope.Test/UnitTests/— Fast tests usingMockRequestAdapterand MoqDescope.Test/IntegrationTests/— Tests against real Descope APIs (requireappsettingsTest.jsonwith ProjectId, ManagementKey, BaseURL)- Integration tests use
RetryUntilSuccessAsyncfromRateLimitedIntegrationTestfor eventual consistency - Integration tests are rate-limited — see
Descope.Test/IntegrationTests/RATE_LIMITING.md
Uses Conventional Commits (feat:, fix:, chore:, etc.) for automatic changelog generation and version bumping via release-please.