Authentication
Oclavex has two credential models, and knowing which one a call uses removes most integration confusion:
| Model | Who holds it | Authenticates |
|---|---|---|
| OAuth client credentials | Your backend / back-office code | admin/* and operational/* endpoints — catalog authoring, entitlement management, code issuance, reporting |
| Activation code + device fingerprint → license session token | Your shipped application | The runtime surface — activation, session renew/check-in/release, usage reporting |
Your backend is a trusted server and identifies itself with a secret. Your shipped application is not — it never carries an API secret; it earns a signed license token by presenting an activation code and a device fingerprint.
API clients and tokens
Section titled “API clients and tokens”Register a client in the portal under Settings → API credentials (guide). The secret is shown once at creation; grant the client only the scopes it needs.
Exchange the id and secret for a token, then carry it as a bearer. Ask for the scopes
the token needs: it carries only the scopes the request asks for, capped to those
registered on the client, so a request that omits scope yields a token that is
refused by every admin/* endpoint.
api.example.com stands in for your tenant endpoint — replace it with your own host.
curl -X POST https://api.example.com/auth/connect/token \ -d grant_type=client_credentials \ -d client_id=$ID -d client_secret=$SECRET \ -d scope="provision.product.* provision.entitlement.*"curl https://api.example.com/api/v1/provision/admin/products \ -H "authorization: Bearer $TOKEN"Tokens are short-lived — cache one and refresh on expiry rather than requesting per call. Scopes may use wildcards and are checked per HTTP verb; the catalog is in Auth & scopes.
License session tokens
Section titled “License session tokens”The activation endpoints are anonymous — no bearer token needed:
curl -X POST https://api.example.com/api/v1/provision/activations/jwt \ -H "content-type: application/json" \ -d '{ "activationCode": "ABC123-DEF456-GHI789", "fingerprint": "device-fingerprint-hash" }'The response is a signed JWT — the license itself. It authenticates every
session-scoped call that follows, on the session it names: POST /activations/renew,
/check-in, /release, and the usage endpoints.
Use POST /activations/license instead of /jwt when the client also needs the
metadata: the entitlement description and license terms link, the licensed products
with the custom properties you marked Public, and each feature’s name and description.
Interactive-user activation
Section titled “Interactive-user activation”When your application has a signed-in user (a SaaS app, a portal), set
useInteractiveUser: true on the activation request and send the user’s token.
The server resolves entitlements assigned to that user; the activation code
becomes optional when the user has exactly one. This is how you license per-user
without distributing codes at all — assign the entitlement to the user and let
sign-in do the rest. The same assignment powers the
end-user portal, where users see and activate
their licenses themselves.
In the .NET SDK
Section titled “In the .NET SDK”The SDK abstracts both models behind IAuthenticationProvider. Two ready-made
providers ship in Revenusion.Oclavex.HttpConnector, which every app gets with
Client.LicenseConsumer.Connected, so they work on every target the SDK supports,
.NET Framework and .NET 8 included:
ClientCredentialsAuthentication— the backend model: discovers the token endpoint, requests and caches tokens, refreshes on expiry. Its constructor takes anHttpClient, the client ID, the secret and the scopes. ThatHttpClientpoints at your tenant’s sign-in authority,https://<tenant host>/auth/, which Settings → Connect your app shows as Sign-in authority. Given the tenant’s own address instead, the first call fails with “Discovery document request failed”.AnonymousAuthentication— for the activation calls themselves. On the session-scoped calls after activation, the SDK presents the license session token itself.
Two more providers, for an app that runs in a host, ship in
Revenusion.Oclavex.Client.AspNetCore, which targets .NET 10 only:
BearerTokenLicenseApiAuthentication— inbound-token pass-through: forwards theAuthorizationbearer token of the host’s current HTTP request. It does not carry the license session token.LicenseSessionTokenAuthenticationProvider— the runtime model in a hosted app: register it withAddLicenseSessionTokenSinkand the SDK sends the license session token on session-scoped calls.
LicenseClientBuilder.UseInteractiveUserActivation() switches the
.NET SDK to interactive-user activation.
If you bring your own IAuthenticationProvider, implement ILicenseTokenSink on it. The
SDK calls SetLicenseToken with the license session token after every successful
activation, renewal and borrow, so your provider can present that token on session-scoped
calls without extra code to pass it around.
Before every activation the SDK calls ClearLicenseToken. Your provider must then forget
the session token and send your application’s own credential again: an activation is
authorized by your application, and the token your provider held belongs to the session served last,
which may be the session the server has just rejected.
What to protect
Section titled “What to protect”- Client secrets stay on your servers. Never embed one in a desktop or mobile build — that’s what the license-session model is for.
- License tokens are bearer credentials for the session; don’t log them.
- Rotation and storage guidance is in Credentials & secrets.