Authlink.Identity.Client.Http 2.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Authlink.Identity.Client.Http --version 2.3.0
                    
NuGet\Install-Package Authlink.Identity.Client.Http -Version 2.3.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.Identity.Client.Http" Version="2.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Authlink.Identity.Client.Http" Version="2.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Authlink.Identity.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.Identity.Client.Http --version 2.3.0
                    
#r "nuget: Authlink.Identity.Client.Http, 2.3.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.Identity.Client.Http@2.3.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.Identity.Client.Http&version=2.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Authlink.Identity.Client.Http&version=2.3.0
                    
Install as a Cake Tool

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
  • 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 v2.3.0

Breaking Changes - Registration Link Flow:

  • Removed ValidateInvitationCodeAsync - This endpoint no longer exists

New Features - Two-Step Registration Link Validation:

  • VerifyRegistrationLinkAsync - Verify a registration link token and get recipient information (Step 1)
  • ValidateRegistrationLinkAsync - Validate a registration link with invitation code and create registration session (Step 2)

Example - Two-Step Registration Link Flow:

// Step 1: Verify the registration link token
var verifyResult = await _client.VerifyRegistrationLinkAsync(new VerifyRegistrationLinkRequest
{
    Token = tokenFromUrl
});

if (verifyResult.IsError)
{
    // Handle error (invalid/expired token)
    return;
}

// Display recipient info to user
Console.WriteLine($"Welcome, {verifyResult.Value.RecipientName}!");

// Step 2: Validate with invitation code entered by user
var validateResult = await _client.ValidateRegistrationLinkAsync(new ValidateRegistrationLinkRequest
{
    Token = tokenFromUrl,
    InvitationCode = userEnteredCode
});

if (validateResult.IsError)
{
    // Handle error (invalid invitation code)
    return;
}

// Redirect to registration
var registrationUrl = validateResult.Value.RegistrationUrl;

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);

// 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);

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

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.3.1 31 3/13/2026
2.3.0 45 3/10/2026
2.2.0 80 3/6/2026
2.1.0 129 2/18/2026
2.0.0 315 11/3/2025
1.0.0 184 10/10/2025