Authlink.Identity.Client.Http
3.5.1
See the version list below for details.
dotnet add package Authlink.Identity.Client.Http --version 3.5.1
NuGet\Install-Package Authlink.Identity.Client.Http -Version 3.5.1
<PackageReference Include="Authlink.Identity.Client.Http" Version="3.5.1" />
<PackageVersion Include="Authlink.Identity.Client.Http" Version="3.5.1" />
<PackageReference Include="Authlink.Identity.Client.Http" />
paket add Authlink.Identity.Client.Http --version 3.5.1
#r "nuget: Authlink.Identity.Client.Http, 3.5.1"
#:package Authlink.Identity.Client.Http@3.5.1
#addin nuget:?package=Authlink.Identity.Client.Http&version=3.5.1
#tool nuget:?package=Authlink.Identity.Client.Http&version=3.5.1
Package Overview
Authlink.Identity.Client.Http provides a ready-to-use, production-grade implementation of the IIdentityClient abstraction defined in Authlink.Identity.Client.Core.
It handles:
- Token acquisition via client credentials and authorization code flows
- OAuth 2.0 Token Exchange (RFC 8693) for delegation scenarios
- Refresh token lifecycle management
- Typed result models for easy integration
- Comprehensive error handling with detailed error information
Install
dotnet add package Authlink.Identity.Client.Http
Or via Package Manager:
PM> Install-Package Authlink.Identity.Client.Http
What's New in v3.0.0
Token claims:
TokenExchangeAsyncnow accepts aPurpose(stamped as thepurposeclaim when permitted for the acting client). Issued tokens also carry atenantclaim.
Breaking changes — instance token exchange removed:
- Removed
RevokeInstanceAsync— useRevokeTokenAsync(RFC 7009) instead. - Removed
InstanceIdfromTokenExchangeRequest— only standard RFC 8693 exchange remains;TaskIdis retained.
Example - Token Exchange:
var result = await _client.TokenExchangeAsync(new TokenExchangeRequest
{
ClientId = "agent-client-id",
ClientSecret = "agent-secret",
SubjectToken = userAccessToken,
SubjectTokenType = "urn:ietf:params:oauth:token-type:access_token",
Scope = "trades:read",
Purpose = "instance-fulfilment"
});
if (result.IsError)
{
Console.WriteLine($"Token exchange failed: {result.FirstError.Description}");
return;
}
var delegatedToken = result.Value.AccessToken;
var issuedType = result.Value.IssuedTokenType;
See CHANGELOG.md for full version history.
Usage
Setup
builder.Services.AddIdentityHttpClient(options =>
{
options.Authority = "https://identity.authlink.co.za";
});
Basic Usage with Error Handling
public class MyService
{
private readonly IIdentityClient _client;
public MyService(IIdentityClient client)
{
_client = client;
}
public async Task<string?> AuthenticateAsync()
{
var result = await _client.TokenAsync(new TokenRequest
{
GrantType = "client_credentials",
ClientId = "your-client-id",
ClientSecret = "your-secret",
Scope = "openid profile"
});
if (result.IsError)
{
var error = result.FirstError;
Console.WriteLine($"Authentication failed: {error.Code} - {error.Description}");
return null;
}
return result.Value.AccessToken;
}
}
Available Methods
// Token endpoint
ErrorOr<TokenResponse> result = await client.TokenAsync(tokenRequest);
// Token Exchange (RFC 8693)
ErrorOr<TokenResponse> exchange = await client.TokenExchangeAsync(tokenExchangeRequest);
// JWKS endpoint
ErrorOr<JsonWebKeySetResponse> jwks = await client.JwksAsync();
// OpenID Configuration
ErrorOr<OpenIdConfigurationResponse> config = await client.ConfigurationAsync();
// UserInfo endpoint
ErrorOr<UserInfoResponse> userInfo = await client.UserInfoAsync(accessToken);
// Registration Link Validation
ErrorOr<VerifyRegistrationLinkResponse> verify = await client.VerifyRegistrationLinkAsync(request);
ErrorOr<ValidateRegistrationLinkResponse> validate = await client.ValidateRegistrationLinkAsync(request);
// Registration Restart — when validation reports the previous session expired while the link is
// still valid, offer the recipient a start-over and call restart with the same token and code.
if (validate.IsError && validate.FirstError.Code == "registration_link.session_expired")
{
ErrorOr<RestartRegistrationLinkResponse> restart = await client.RestartRegistrationLinkAsync(
new RestartRegistrationLinkRequest
{
Token = token,
InvitationCode = invitationCode
});
}
Error Handling
The client returns specific error types for different failure scenarios:
| Error Code | Description |
|---|---|
IdentityClient.HttpRequestFailed |
HTTP errors with status codes |
IdentityClient.ProtocolError |
OAuth/OIDC protocol errors |
IdentityClient.NetworkError |
Connection failures |
IdentityClient.OperationTimeout |
Request timeouts |
IdentityClient.DeserializationFailed |
JSON parsing errors |
The registration-link operations (VerifyRegistrationLinkAsync, ValidateRegistrationLinkAsync,
RestartRegistrationLinkAsync) preserve Authlink registration domain error codes verbatim (e.g.
registration_link.session_expired, registration_link.invalid) so callers can branch on the
specific outcome. Malformed or empty error bodies fall back to IdentityClient.HttpRequestFailed.
Documentation
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Authlink.Identity.Client.Core (>= 3.5.1)
- ErrorOr (>= 2.0.1)
- Microsoft.Extensions.DependencyInjection (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
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 |
|---|---|---|
| 3.7.0 | 51 | 11/17/2026 |
| 3.5.1 | 365 | 10/2/2026 |
| 3.5.0 | 2,419 | 8/31/2026 |
| 3.4.0 | 328 | 8/17/2026 |
| 3.3.0 | 360 | 7/31/2026 |
| 3.2.0 | 149 | 7/27/2026 |
| 3.1.0 | 134 | 7/24/2026 |
| 3.0.0 | 593 | 7/14/2026 |
| 2.4.0 | 1,699 | 5/20/2026 |
| 2.3.1 | 555 | 3/13/2026 |
| 2.3.0 | 182 | 3/10/2026 |
| 2.2.0 | 142 | 3/6/2026 |
| 2.1.0 | 197 | 2/18/2026 |
| 2.0.0 | 7,424 | 11/3/2025 |
| 1.0.0 | 233 | 10/10/2025 |