Akiles.ApiClient
1.0.0-beta.2
dotnet add package Akiles.ApiClient --version 1.0.0-beta.2
NuGet\Install-Package Akiles.ApiClient -Version 1.0.0-beta.2
<PackageReference Include="Akiles.ApiClient" Version="1.0.0-beta.2" />
<PackageVersion Include="Akiles.ApiClient" Version="1.0.0-beta.2" />
<PackageReference Include="Akiles.ApiClient" />
paket add Akiles.ApiClient --version 1.0.0-beta.2
#r "nuget: Akiles.ApiClient, 1.0.0-beta.2"
#:package Akiles.ApiClient@1.0.0-beta.2
#addin nuget:?package=Akiles.ApiClient&version=1.0.0-beta.2&prerelease
#tool nuget:?package=Akiles.ApiClient&version=1.0.0-beta.2&prerelease
Akiles.ApiClient
Unofficial API client for Akiles Access Control.
A prerelease package is availble on nuget
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:
- Authorize the application once, requesting the
offlinescope to receive a refresh token. - Store the refresh token in your backend.
- 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.
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 plainhttpis allowed forlocalhost.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 thecodevalue from the address bar.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_tokenIf
refresh_tokenis empty, theofflinescope 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 | Versions 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. |
-
net10.0
- Cursor (>= 0.5.3)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- OneOf (>= 3.0.271)
- Refit (>= 16.4.0)
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 |