Keycloak.NETCore.Client 1.0.1

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

🔐 Keycloak Client for .NET Core

🚀 A powerful and feature-rich .NET Core client library for Keycloak that simplifies integration with Keycloak's authentication and authorization services. This enterprise-ready library provides a comprehensive implementation of Keycloak's REST API, with full support for OpenID Connect, OAuth 2.0, and User-Managed Access (UMA 2.0) protocols.


⚙️ Requirements

Category Supported Versions
.NET 6.0, 7.0, 8.0
Dependencies ASP.NET Core, Microsoft.Extensions.DependencyInjection, Newtonsoft.Json

✅ Version Compatibility

Keycloak Version Support
26.x
25.x
24.x
23.x
22.x
21.x
20.x

🌟 Key Features

  • 🔄 Complete Keycloak REST API integration
  • 🛡️ Robust security with OpenID Connect and OAuth 2.0
  • 📊 Built-in monitoring and performance metrics
  • 🔍 Comprehensive error handling and debugging
  • 🚦 Automated token management and renewal
  • 👥 Advanced user and group management
  • 🔑 Multiple authentication flows support
  • 📈 Enterprise-grade scalability

💻 Installation

To integrate the Keycloak client library into your .NET Core application, simply add the NuGet package:

Install-Package Keycloak.NETCore.Client

🚀 Getting Started

📋 Prerequisites

  • ✳️ .NET Core SDK (version 6.0 or later)
  • 🖥️ A running Keycloak instance
  • 🔑 Client credentials and realm configuration

🔧 Basic Setup

  1. Add the Keycloak client to your services in Program.cs or Startup.cs:
services.AddKeycloakAuthentication(options =>
{
    options.KeycloakBaseUrl = "http://localhost:8080";
    options.RealmAdminCredentials = new KcClientCredentials
    {
        ClientId = "your-client-id",
        ClientSecret = "your-client-secret"
    };
});

📖 Basic Usage

Here's a quick example of how to use the library:

// Create Keycloak client
var keycloakClient = new KeycloakClient("http://localhost:8080");

// Authenticate
var token = await keycloakClient.Auth.GetClientCredentialsTokenAsync(
    "your-realm",
    new KcClientCredentials
    {
        ClientId = "your-client-id",
        ClientSecret = "your-client-secret"
    });

// Use the token for other operations
var users = await keycloakClient.Users.GetAsync(
    "your-realm",
    token.AccessToken,
    new KcUserFilter { MaxResults = 10 });

📄 License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on Keycloak.NETCore.Client:

Package Downloads
affolterNET.Web.Core

Core authentication and authorization components for web applications

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 6,303 2/23/2025
1.0.1 148 2/15/2025
1.0.0 162 2/15/2025