Akiles.ApiClient 1.0.0-beta.2

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

Akiles.ApiClient

Unofficial API client for Akiles Access Control. A prerelease package is availble on nuget Akiles.ApiClient

The client is native aot compatible.

Usage

The client authenticates using OAuth 2.0 (see doc). Create an application in the Akiles Developer Center to obtain a client id and client secret.

The flow is:

  1. Authorize the application once, requesting the offline scope to receive a refresh token.
  2. Store the refresh token in your backend.
  3. Use the refresh token to obtain access tokens. The client does this automatically, caching each access token and renewing it shortly before it expires.

Register the client

services.AddAkilesApiClient(options =>
{
    options.ClientId = "client id";
    options.ClientSecret = "client secret";
    options.RefreshToken = "stored refresh token";
});

and later obtain an IAkilesApiClient to explore the api.

If you integrate with multiple organizations, omit RefreshToken and use the IAkilesApiClientFactory:

var client = factory.CreateWithRefreshToken(refreshToken);

A client for an already obtained access token can be created with factory.Create(accessToken).

Obtain a refresh token from your application

Use IAkilesOAuthClient to authorize the application:

// Redirect the user to the authorization page
var uri = oauthClient.GetAuthorizationUri(
    "https://example.com/akiles/callback",
    [AkilesScopes.FullReadWrite, AkilesScopes.Offline],
    state
);

// In the callback, exchange the returned code for tokens and store the refresh token
var token = await oauthClient.ExchangeAuthorizationCodeAsync(code);
await SaveRefreshTokenAsync(token.RefreshToken);

Obtain a refresh token manually

If you only need a single refresh token, e.g. for a backend that integrates with your own organization or for running the tests, it can be obtained by hand. Refresh tokens do not expire, so this only needs to be done once.

  1. In the Akiles Developer Center, add a redirect URI to your application, e.g. http://localhost:5000/callback. Nothing needs to listen on that address, and plain http is allowed for localhost.

  2. Open the authorization page and approve access to the organization:

    $clientId     = "YOUR_CLIENT_ID"
    $clientSecret = "YOUR_CLIENT_SECRET"
    $redirect     = "http://localhost:5000/callback"
    
    Start-Process ("https://auth.akiles.app/oauth2/auth?response_type=code" +
      "&client_id=$clientId" +
      "&redirect_uri=$([uri]::EscapeDataString($redirect))" +
      "&scope=full_read_write%20offline" +
      "&state=somerandomstate123")
    

    The browser is redirected to http://localhost:5000/callback?code=...&state=... and shows a connection error. This is expected. Copy the code value from the address bar.

  3. Exchange the code for tokens. The code can only be used once and expires after 15 minutes.

    $code = "PASTE_CODE_HERE"
    $token = Invoke-RestMethod -Method Post -Uri "https://auth.akiles.app/oauth2/token" -Body @{
      grant_type    = "authorization_code"
      client_id     = $clientId
      client_secret = $clientSecret
      code          = $code
      redirect_uri  = $redirect
    }
    $token.refresh_token
    

    If refresh_token is empty, the offline scope was not included in step 2.

Running the tests

The tests run against the live Akiles API, so use a dedicated test organization. Some tests expect the organization to be empty, and others create and delete objects.

Obtain a refresh token for the test organization as described in Obtain a refresh token manually, and store the credentials as user secrets for the test project:

cd test\Akiles.ApiClient.Tests
dotnet user-secrets set AkilesClientId $clientId
dotnet user-secrets set AkilesClientSecret $clientSecret
dotnet user-secrets set AkilesRefreshToken $token.refresh_token

Then run dotnet test from the repository root.

Status

The implemented API surface should work, but there are missing endpoints. Feel free to create a PR if there are parts that are missing that you need.

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.

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.0.0-beta.2 57 11/4/2026
1.0.0-alpha.3 92 8/6/2026
1.0.0-alpha.2 95 5/1/2026
1.0.0-alpha.1 132 1/27/2026
1.0.0-alpha.0 110 1/27/2026
0.0.11 287 11/24/2025
0.0.10 258 11/24/2025
0.0.9 373 5/12/2025
0.0.8 299 5/12/2025
0.0.7 229 5/9/2025
0.0.6 253 5/9/2025
0.0.5 267 5/7/2025
0.0.4 285 5/6/2025
0.0.3 290 5/5/2025
0.0.2 246 5/2/2025
0.0.1 300 4/30/2025