AuthClient 1.5.4

dotnet add package AuthClient --version 1.5.4
                    
NuGet\Install-Package AuthClient -Version 1.5.4
                    
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="AuthClient" Version="1.5.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AuthClient" Version="1.5.4" />
                    
Directory.Packages.props
<PackageReference Include="AuthClient" />
                    
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 AuthClient --version 1.5.4
                    
#r "nuget: AuthClient, 1.5.4"
                    
#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 AuthClient@1.5.4
                    
#: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=AuthClient&version=1.5.4
                    
Install as a Cake Addin
#tool nuget:?package=AuthClient&version=1.5.4
                    
Install as a Cake Tool

AuthClient

A lightweight .NET authentication SDK for working with an auth API.

AuthClient provides simple async methods for modern authentication workflows:

  • user registration
  • login (with optional MFA/TOTP)
  • logout
  • get current user
  • delete user
  • admin user management
  • OpenID Connect (OIDC)
  • multi-factor authentication (MFA)
  • password reset
  • mail service configuration

Built by Brume Ako.


Features

  • Simple, clean API
  • Async-first design
  • Token-based authentication
  • OIDC provider support
  • MFA (TOTP + QR setup)
  • Password reset flows
  • Mail service configuration (admin)
  • Easy integration with any .NET app

Installation

dotnet add package AuthClient

Requirements

  • .NET 6.0 or later

  • A backend API with endpoints:

    • POST /register
    • POST /login
    • POST /logout
    • GET /me
    • DELETE /delete
    • GET /admin/users
    • DELETE /admin/delete-user/{user_id}
    • POST /oidc/register
    • DELETE /oidc/remove
    • GET /oidc/login-url/{provider}
    • POST /mfa/setup
    • POST /mfa/verify
    • DELETE /mfa/disable
    • POST /auth/reset-request
    • POST /auth/password-reset
    • POST /modify-mail
    • DELETE /remove-mail

Getting Started

Create the client

using AuthClient;

var client = new AuthClient.AuthClient("https://your-api-url.com");

Usage

Register

var result = await client.RegisterAsync(
    "user@example.com",
    "StrongPassword123",
    "John Doe"
);

Login

var result = await client.LoginAsync(
    "user@example.com",
    "StrongPassword123"
);

Login with MFA

var result = await client.LoginMfaAsync(
    "user_id",
    "123456"
);

Login with refresh token

var result = await client.LoginRefreshTokenAsync(
    "refresh-token"
);

get refresh token

var result = await client.GetRefreshTokenAsync(
  "your-jwt-token"  
);

Logout

await client.LogoutAsync("your-jwt-token");

Get current user

var user = await client.GetUserAsync("your-jwt-token");

Delete current user

await client.DeleteUserAsync("your-jwt-token");

Check Email Exists in db

await client.CheckEmail("email")

Get all users (admin)

var users = await client.GetAllUsersAsync("admin-token");

Delete user (admin)

await client.AdminDeleteUserAsync("admin-token", "user-id");

OpenID Connect (OIDC)

Register provider (admin)

await client.RegisterOidcProviderAsync(
    "admin-key",
    "google",
    "client-id",
    "client-secret",
    "https://accounts.google.com/.well-known/openid-configuration"
);

Remove provider (admin)

await client.RemoveOidcProvider("admin-key", "google");

Get login URL

var url = await client.LoginWithOidc("google");

Open the returned URL in a browser to authenticate.


Multi-Factor Authentication (MFA)

Setup MFA (QR Code)

byte[] qrCode = await client.SetupMfa("your-jwt-token");
File.WriteAllBytes("qrcode.png", qrCode);

Verify MFA

await client.VerifyMfa("your-jwt-token", "123456");

Disable MFA

await client.DisableMfa("your-jwt-token", "123456");

Password Reset

Request reset

await client.RequestPasswordReset("user@example.com");

Reset password

await client.ResetPassword(
    "user@example.com",
    "NewPassword123",
    "reset-code"
);

Mail Service (Admin)

Configure mail

await client.ModifyMailService(
    "admin-key",
    "sender",
    "sendgrid-api-key"
);

Remove mail service

await client.DeleteMailServiceAsync("admin-token");

Error Handling

All requests use EnsureSuccessStatusCode().

Wrap calls in try/catch:

try
{
    await client.LoginAsync("user@example.com", "password");
}
catch (HttpRequestException ex)
{
    Console.WriteLine(ex.Message);
}

Notes

  • Responses are returned as JsonElement
  • Tokens must be passed manually
  • OIDC providers are registered at runtime
  • MFA setup returns a QR code image (PNG)
  • Designed to be minimal and flexible

Project Structure

AuthClient/
├── AuthClient/   # SDK (published to NuGet)
└── TestApp/      # Example app (not published)

License

MIT License


Author

Brume Ako

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

    • No dependencies.

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
1.5.4 136 3/26/2026
1.5.3 102 3/26/2026
1.5.2 105 3/26/2026
1.5.1 104 3/26/2026
1.5.0 102 3/26/2026
1.4.1 104 3/26/2026
1.4.0 102 3/26/2026
1.3.1 100 3/26/2026
1.3.0 122 3/26/2026
1.2.1 111 3/24/2026
1.2.0 117 3/24/2026
1.1.0 128 3/24/2026
1.0.0 134 3/24/2026