Authlink.Portal.Client.Http
2.13.0
See the version list below for details.
dotnet add package Authlink.Portal.Client.Http --version 2.13.0
NuGet\Install-Package Authlink.Portal.Client.Http -Version 2.13.0
<PackageReference Include="Authlink.Portal.Client.Http" Version="2.13.0" />
<PackageVersion Include="Authlink.Portal.Client.Http" Version="2.13.0" />
<PackageReference Include="Authlink.Portal.Client.Http" />
paket add Authlink.Portal.Client.Http --version 2.13.0
#r "nuget: Authlink.Portal.Client.Http, 2.13.0"
#:package Authlink.Portal.Client.Http@2.13.0
#addin nuget:?package=Authlink.Portal.Client.Http&version=2.13.0
#tool nuget:?package=Authlink.Portal.Client.Http&version=2.13.0
Package Overview
Authlink.Portal.Client.Http provides a ready-to-use, production-grade implementation of the IPortalClient abstraction defined in Authlink.Portal.Client.Core.
Install
dotnet add package Authlink.Portal.Client.Http
Or via Package Manager:
PM> Install-Package Authlink.Portal.Client.Http
What's New in v2.13.0
New Features - Public Client User Management by OAuth2 Client ID:
AddPublicClientUserAsync- Add a user to a public client using its OAuth2 client IDRemovePublicClientUserAsync- Remove a user from a public client using its OAuth2 client ID
This enables consuming applications to manage public client users using the OAuth2 client ID they already know, rather than requiring the internal public client identifier.
Example - Add User to Public Client:
var result = await _client.AddPublicClientUserAsync(new AddPublicClientUserRequest
{
ClientId = oAuth2ClientId, // The OAuth2 client ID, not the internal public client ID
UserId = userId
});
if (result.IsError)
{
// Handle error
return;
}
var publicClientUserId = result.Value.PublicClientUserId;
Example - Remove User from Public Client:
var result = await _client.RemovePublicClientUserAsync(new RemovePublicClientUserRequest
{
ClientId = oAuth2ClientId,
UserId = userId
});
See CHANGELOG.md for full version history.
Usage
Setup
builder.Services.AddPortalHttpClient(options =>
{
options.BaseUrl = "https://portal.authlink.co.za";
options.AccessToken = "your-access-token";
});
Basic Usage
public class MyService
{
private readonly IPortalClient _client;
public MyService(IPortalClient client)
{
_client = client;
}
public async Task GetUsersAsync()
{
var result = await _client.GetUsersAsync(new GetUsersRequest
{
PageNumber = 1,
PageSize = 10
});
if (result.IsError)
{
var error = result.FirstError;
Console.WriteLine($"Error: {error.Code} - {error.Description}");
return;
}
var response = result.Value;
Console.WriteLine($"Found {response.TotalCount} users");
}
}
Pattern Matching
var result = await _client.GetUserByIdAsync(new GetUserByIdRequest { UserId = userId });
return result.Match(
user => Ok(user),
errors => errors[0].Type switch
{
ErrorType.NotFound => NotFound(),
ErrorType.Unauthorized => Unauthorized(),
ErrorType.Forbidden => Forbid(),
_ => Problem(errors[0].Description)
}
);
Error Types
| Error Code | Error Type | HTTP Status | Description |
|---|---|---|---|
Portal.ValidationFailed |
Validation | 400 | Request validation failed |
Portal.Unauthorized |
Unauthorized | 401 | Authentication required |
Portal.Forbidden |
Forbidden | 403 | Insufficient permissions |
Portal.NotFound |
NotFound | 404 | Resource not found |
Portal.Conflict |
Conflict | 409 | Resource conflict |
Portal.Timeout |
Failure | 408 | Request timed out |
Portal.NetworkError |
Failure | - | Network/connection error |
Authentication Options
Option 1: Static Token (Recommended)
builder.Services.AddPortalHttpClient(options =>
{
options.BaseUrl = "https://portal.authlink.co.za";
options.AccessToken = configuration["Authlink:Portal:AccessToken"];
});
Option 2: Custom Token Provider
builder.Services.AddScoped<IAccessTokenProvider, MyTokenProvider>();
builder.Services.AddPortalHttpClient(options =>
{
options.BaseUrl = "https://portal.authlink.co.za";
});
Runtime Token Updates
if (_tokenProvider is MutableAccessTokenProvider mutableProvider)
{
mutableProvider.SetAccessToken(newToken);
}
Testing
The package includes comprehensive integration tests. See Integration Tests Documentation.
Documentation
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- Authlink.Portal.Client.Core (>= 2.13.0)
- ErrorOr (>= 2.0.1)
- Microsoft.Extensions.DependencyInjection (>= 9.0.9)
- Microsoft.Extensions.Http (>= 9.0.9)
- Microsoft.Extensions.Options (>= 9.0.9)
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 |
|---|---|---|
| 2.19.0 | 78 | 6/10/2026 |
| 2.17.0 | 125 | 5/19/2026 |
| 2.16.0 | 114 | 4/28/2026 |
| 2.15.0 | 102 | 4/24/2026 |
| 2.14.0 | 109 | 4/16/2026 |
| 2.13.0 | 110 | 3/26/2026 |
| 2.12.1 | 114 | 3/13/2026 |
| 2.12.0 | 118 | 3/12/2026 |
| 2.11.0 | 111 | 3/11/2026 |
| 2.10.0 | 108 | 3/6/2026 |
| 2.9.0 | 109 | 2/18/2026 |
| 2.8.0 | 112 | 2/18/2026 |
| 2.7.0 | 128 | 1/30/2026 |
| 2.6.0 | 113 | 1/29/2026 |
| 2.5.0 | 121 | 1/29/2026 |
| 2.4.0 | 114 | 1/28/2026 |
| 2.3.0 | 126 | 1/7/2026 |
| 2.2.4 | 112 | 1/7/2026 |
| 2.2.3 | 119 | 1/7/2026 |
| 2.2.2 | 314 | 11/12/2025 |