Skip to content
  • SDKs and APIs
  • Back end SDKs

.NET SDK

Kinde auth can be integrated into your application without the need for an SDK. Follow the appropriate guide to secure your API or use OpenID Connect to secure your web application:

The Kinde .NET SDK allows developers to quickly and securely call the Kinde Management API. The Kinde SDK is available from the Nuget package repository at https://www.nuget.org/packages/Kinde.SDK

Before you begin

Link to this section

Add packages to your application

Link to this section

Use Dotnet CLI or NuGet CLI to add packages in your project.

Dotnet CLI:

Terminal window
dotnet add package Kinde.SDK

NuGet:

Terminal window
NuGet\Install-Package Kinde.SDK

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.

Configure API client

Link to this section

Create and authorize a new client:

var client = new KindeClient(new ApplicationConfiguration("<your-kinde-domain>", "", ""), new KindeHttpClient());
await client.Authorize(new ClientCredentialsConfiguration("<your-client-id>", "", "<your-client-secret>", "https://<your-kinde-domain>/api"));

Replacing <your-kinde-domain> with your Kinde domain, <your-client-id> and <your-client-secret> with your machine to machine app keys.

Call management API

Link to this section

The client can be used to call the management API. For example, listing users:

var usersApi = new UsersApi(client);
var users = await usersApi.GetUsersAsync();
foreach (var user in users.Users)
{
Console.WriteLine($"Id: {user.Id}, Email: {user.Email}, Name: {user.FirstName} {user.LastName}.");
}

Note this requires the read:users scope to be added to the API in the machine to machine application in Kinde.

An example of creating an organization then renaming it:

var orgApi = new OrganizationsApi(client);
var newOrg = await orgApi.CreateOrganizationAsync(new CreateOrganizationRequest("My new organization"));
var response = await orgApi.UpdateOrganizationAsync(newOrg.Organization.Code, new UpdateOrganizationRequest()
{
Name = "A different name"
});

Note this requires the create:organizations and update:organizations scopes to be added to the API in the machine to machine application in Kinde.

For full details of the available management API functions, see the Kinde Management API specification.

If you need help getting Kinde connected, contact us at support@kinde.com.