Authlink.Portal.Client.Http 2.12.0

dotnet add package Authlink.Portal.Client.Http --version 2.12.0
                    
NuGet\Install-Package Authlink.Portal.Client.Http -Version 2.12.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Authlink.Portal.Client.Http" Version="2.12.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Authlink.Portal.Client.Http" Version="2.12.0" />
                    
Directory.Packages.props
<PackageReference Include="Authlink.Portal.Client.Http" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Authlink.Portal.Client.Http --version 2.12.0
                    
#r "nuget: Authlink.Portal.Client.Http, 2.12.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Authlink.Portal.Client.Http@2.12.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Authlink.Portal.Client.Http&version=2.12.0
                    
Install as a Cake Addin
#tool nuget:?package=Authlink.Portal.Client.Http&version=2.12.0
                    
Install as a Cake Tool

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.11.0

New Features - Registration Link Management:

  • GetRegistrationLinksAsync - List registration links with filtering
  • GetRegistrationLinkAsync - Get a single registration link by ID
  • GetRegistrationLinkBatchAsync - Get batch details including progress
  • CreateRegistrationLinkAsync - Create a single registration link
  • CreateRegistrationLinkBatchAsync - Create multiple registration links in a batch
  • RevokeRegistrationLinkAsync - Revoke a registration link
  • ResendRegistrationLinkAsync - Resend a registration link email

Example - Create Single Registration Link:

var result = await _client.CreateRegistrationLinkAsync(new CreateRegistrationLinkRequest
{
    InvitationCodeId = invitationCodeId,
    RecipientEmail = "user@example.com",
    RecipientName = "John Doe",
    ExpiresInDays = 7
});

if (result.IsError)
{
    // Handle error
    return;
}

var registrationLinkId = result.Value.RegistrationLinkId;

Example - Create Batch:

var result = await _client.CreateRegistrationLinkBatchAsync(new CreateRegistrationLinkBatchRequest
{
    InvitationCodeId = invitationCodeId,
    Recipients = new List<RecipientInfoDto>
    {
        new() { Email = "user1@example.com", Name = "User One" },
        new() { Email = "user2@example.com", Name = "User Two" }
    },
    ExpiresInDays = 7
});

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

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

https://docs.authlink.co.za

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.12.0 0 3/12/2026
2.11.0 73 3/11/2026
2.10.0 77 3/6/2026
2.9.0 87 2/18/2026
2.8.0 91 2/18/2026
2.7.0 108 1/30/2026
2.6.0 94 1/29/2026
2.5.0 100 1/29/2026
2.4.0 93 1/28/2026
2.3.0 106 1/7/2026
2.2.4 92 1/7/2026
2.2.3 100 1/7/2026
2.2.2 297 11/12/2025
2.2.1 247 11/10/2025
2.2.0 245 11/10/2025
2.1.0 206 11/4/2025
2.0.0 219 11/3/2025
1.0.1 202 10/29/2025
1.0.0 176 10/10/2025