Authaz.Sdk 0.1.2

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

Authaz.Sdk

Official .NET SDK for the Authaz Management API. Authentication, authorization, and identity management for your applications.

Install

dotnet add package Authaz.Sdk

Quickstart

using Authaz.Sdk;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddAuthazSdk(opts =>
{
    opts.BaseAddress = new Uri("https://api.authaz.com");
    opts.ApiKey      = "your-api-key";
});

var sp     = services.BuildServiceProvider();
var authaz = sp.GetRequiredService<IAuthazClient>();

// List users
var result = await authaz.Users.ListAsync();
if (result.IsSuccess)
    Console.WriteLine($"Found {result.Value!.Data.Count} users");

With ASP.NET Core

builder.Services.AddAuthazSdk(opts =>
{
    opts.BaseAddress = new Uri(builder.Configuration["Authaz:BaseUrl"]!);
    opts.ApiKey      = builder.Configuration["Authaz:ApiKey"];
});

// Inject IAuthazClient anywhere:
app.MapGet("/users", async (IAuthazClient authaz) =>
{
    var result = await authaz.Users.ListAsync();
    return result.IsSuccess ? Results.Ok(result.Value) : Results.Problem(result.Error!.Message);
});

Error handling

Every method returns AuthazResult<T> — a discriminated union that is either successful or a typed error. No exceptions for expected API failures.

var result = await authaz.Users.GetAsync(userId);

switch (result.Error)
{
    case null:
        Console.WriteLine(result.Value!.Email);
        break;
    case AuthazError.NotFound:
        Console.WriteLine("User not found");
        break;
    case AuthazError.Unauthorized:
        Console.WriteLine("Invalid API key");
        break;
    case AuthazError.Forbidden e:
        Console.WriteLine($"Permission denied: {e.Message}");
        break;
    case AuthazError.Validation e:
        foreach (var f in e.Fields)
            Console.WriteLine($"{f.Field}: {f.Message}");
        break;
    case AuthazError.RateLimited e:
        Console.WriteLine($"Rate limited — retry after {e.RetryAfter}");
        break;
    case AuthazError.Server e:
        Console.WriteLine($"Server error {e.StatusCode}: {e.Message}");
        break;
    case AuthazError.Network e:
        Console.WriteLine($"Network failure: {e.InnerException.Message}");
        break;
    case AuthazError.Canceled:
        Console.WriteLine("Operation was canceled");
        break;
}

Sub-clients

IAuthazClient exposes 8 top-level sub-clients:

Property Description
Users List, get, suspend, activate, unlock, delete users; manage sessions and MFA
Applications CRUD apps; branding, custom domains, config
Tenants Multi-tenant management; per-tenant auth provider config
Authorization Roles, policies (RBAC + MFA/password/session/lockout), permission checks
Invitations Send and manage invitations
Email Email provider config and transactional templates
Auth API key management (org/app scoped + user-bound); OAuth and M2M credentials; auth flow; account recovery
Audit Trail log access with cursor pagination and full-text search

Custom credential provider

Implement IAuthazCredentialProvider for non-API-key authentication (e.g. forwarding a user's bearer token from an HTTP context):

public sealed class MyCredentialProvider(IHttpContextAccessor ctx) : IAuthazCredentialProvider
{
    public ValueTask ApplyAsync(HttpRequestMessage request, CancellationToken ct)
    {
        var token = ctx.HttpContext?.Request.Cookies["access_token"];
        if (!string.IsNullOrEmpty(token))
            request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
        return ValueTask.CompletedTask;
    }
}

// Registration:
services.AddAuthazSdk(opts => { opts.BaseAddress = ...; })
        .WithCredentials<MyCredentialProvider>();

Supported frameworks

net8.0 · net9.0 · net10.0 — AOT-compatible

License

MIT

Product 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 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 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. 
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
0.5.1 0 6/27/2026
0.5.0 349 6/14/2026
0.4.0 397 6/10/2026
0.3.4 159 6/9/2026
0.3.3 114 6/9/2026
0.3.2 174 6/5/2026
0.3.1 334 5/31/2026
0.3.0 110 5/31/2026
0.2.0 170 5/31/2026
0.1.2 282 5/20/2026
0.1.1 254 5/12/2026
0.1.0 407 4/28/2026