Documentation

Protect your API

Register an API, define its permissions, decide who gets them, and check them in the API.

All documentation

Register each API that accepts Auth access tokens. A token for it names the API as aud and carries in scope only the permissions that pass every filter: the API defines them, the application was granted them, the application asked for them, and, with role-based access control on, the person's roles map to them. Anything else is left out of the token without an error.

Register the API

In https://app.ziqme.com/auth-admin open APIs and choose "Register an API". The identifier is an https URI or a urn:, unique across Auth (every workspace shares the issuer and its keys), and cannot change later. Permissions such as orders:read carry a description in English and, optionally, Persian, which the consent screen shows. Protocol names such as openid, profile, email, roles and offline_access are reserved.

Admin API
POST /api/v1/auth/apis
{ "name": "Orders", "identifier": "https://api.bistro.example", "enforceRbac": true,
  "permissions": [{ "value": "orders:read", "description": "See your orders" }] }
SettingEffect
accessTokenLifetimeMinutes1 to 1440; empty uses the application's lifetime
allowOfflineAccessOff: no refresh token for this API
enforceRbacPeople receive only what their application or organization roles map to
addPermissionsToTokenAdds a permissions array beside scope

Grant access

On an application's API access tab, allow the API and tick the permissions it may request. Without a grant the application gets no token for the API: the request answers invalid_target. With RBAC on, map application roles and organization roles to permissions on the API's Roles tab.

Ask for a token

Sign a person in
const url = auth.authorizeUrl({
  redirectUri, state, codeChallenge: pkce.challenge,
  scope: ['openid', 'profile', 'orders:read'],
  resource: 'https://api.bistro.example',
})
A machine token
curl -X POST https://auth.ziqme.com/token \
  -u app_your_client_id:YOUR_SECRET \
  -d grant_type=client_credentials \
  -d audience=https://api.bistro.example -d scope=orders:read
  • resource (RFC 8707) and audience mean the same; send one API per request.
  • A refresh keeps the API and never adds a permission. Each refresh drops what was withdrawn since; deleting the API or the grant ends the session.
  • An API token that also holds openid is accepted at UserInfo.

Check the token in the API

.NET
.AddAuthSdkBearer(o => { o.Issuer = "https://auth.ziqme.com"; o.Audience = "https://api.bistro.example"; o.TenantId = "your-workspace-id"; });

[HttpGet, RequireScope("orders:read")]
public IActionResult List() => Ok();
TypeScript
const claims = await verifyJwt(token, { issuer: 'https://auth.ziqme.com', audience: 'https://api.bistro.example', type: 'at+jwt', tenantId: 'your-workspace-id' })
if (!hasScopes(claims, ['orders:read'])) return forbidden()

Mark an application third-party when your workspace does not build it. Its users then see a consent screen with the application's name, logo and colour, listing what it asks for in English or Persian. The answer is remembered per person and application; the screen comes back for anything new or for prompt=consent, and prompt=none answers consent_required. People take consent back on the hosted account page, administrators on the application's API access tab; either ends the person's sessions in that application. First-party applications never ask.

APIs are not counted against your plan yet. A workspace may register up to 100. Discovery lists the OpenID Connect scopes only: an API's permissions belong to your workspace.