DioRed.Aith.Client
1.0.0-preview.7
dotnet add package DioRed.Aith.Client --version 1.0.0-preview.7
NuGet\Install-Package DioRed.Aith.Client -Version 1.0.0-preview.7
<PackageReference Include="DioRed.Aith.Client" Version="1.0.0-preview.7" />
<PackageVersion Include="DioRed.Aith.Client" Version="1.0.0-preview.7" />
<PackageReference Include="DioRed.Aith.Client" />
paket add DioRed.Aith.Client --version 1.0.0-preview.7
#r "nuget: DioRed.Aith.Client, 1.0.0-preview.7"
#:package DioRed.Aith.Client@1.0.0-preview.7
#addin nuget:?package=DioRed.Aith.Client&version=1.0.0-preview.7&prerelease
#tool nuget:?package=DioRed.Aith.Client&version=1.0.0-preview.7&prerelease
DioRed.Aith.Client
DioRed.Aith.Client provides a strongly-typed, high-level OAuth 2.0 client for client_credentials (service-to-service) authentication against Aith from DioRED.
It handles:
- Fetching access tokens using
client_id+client_secret - Token caching and automatic refresh
- Attaching
Authorization: Bearerheaders to outgoing requests - Seamless HttpClient integration via
IHttpClientFactory
🚀 Installation
dotnet add package DioRed.Aith.Client
✨ Quick Start
Register an Aith-backed HttpClient:
builder.Services.AddAithClient("my-api", o =>
{
o.Authority = "https://auth.example.com";
o.ClientId = "service-a";
o.ClientSecret = builder.Configuration["Aith:ServiceA:Secret"];
o.Scopes = new[] { "my-api.read" };
});
builder.Services.AddHttpClient("my-api", client =>
{
client.BaseAddress = new Uri("https://api.example.com");
});
Use it in services:
public class ApiService
{
private readonly HttpClient _client;
public ApiService(IHttpClientFactory factory)
{
_client = factory.CreateClient("my-api");
}
public async Task<string> GetDataAsync()
{
var response = await _client.GetStringAsync("/v1/data");
return response;
}
}
All requests automatically receive:
Authorization: Bearer {access_token}
🔐 How It Works
The library implements:
AithTokenClient
Retrieves and caches client_credentials tokens from:
POST {Authority}/oauth/token
grant_type=client_credentials
client_id=...
client_secret=...
scope=...
AithClientCredentialsHandler
A delegating handler that:
- obtains a fresh token when needed,
- attaches it to each outbound request.
AddAithClient(...)extension
Registers all required components with proper DI lifetimes.
⚙️ Advanced Usage
Custom scopes:
o.Scopes = new[] { "payments.write", "orders.read" };
Custom token endpoint:
o.TokenEndpoint = "https://auth.example.com/custom-token";
Multiple Aith-backed HttpClients:
builder.Services.AddAithClient("service-a", ...);
builder.Services.AddAithClient("service-b", ...);
📚 Summary
Use DioRed.Aith.Client for any app-to-api or microservice-to-microservice authentication:
- backend jobs
- background services
- microservice communication
- internal admin tools
- API gateways
For interactive login in web apps (Authorization Code + PKCE), use:
👉 DioRed.Aith.AspNetCore (NuGet)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.7 | 89 | 5/11/2026 |
| 1.0.0-preview.6 | 73 | 4/21/2026 |
| 1.0.0-preview.5 | 91 | 12/29/2025 |