Standards · delegation

# Delegation & CIBA

Three standards for apps and agents that act for a person: **token exchange** (RFC 8693) to hand a narrower token to another service or agent, **rich authorization requests** (RFC 9396) to ask for one specific thing instead of a broad scope, and **CIBA** (OpenID Connect Client-Initiated Backchannel Authentication) to ask the person to approve on their own device.

Every feature is opt-in per environment: open your app in the developer console, pick an environment and use the **Delegation** card. Only confidential (server-side) environments can use them. The operator of this Identvia server can switch each feature off; discovery at https://id.identvia.com/.well-known/openid-configuration always tells you what is on.

## Token exchange (RFC 8693)

Trade an access token you hold for a new, shorter-lived token that is narrower and, optionally, names the agent acting for the person.

HTTP

```
POST /oauth/token
Authorization: Basic base64(client_id:client_secret)
Content-Type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&subject_token=<access token issued to you>
&subject_token_type=urn:ietf:params:oauth:token-type:access_token
&audience=<another Identvia client_id, or the MCP resource>
&scope=openid email
&actor_token=<agent JWT, optional>
&actor_token_type=urn:ietf:params:oauth:token-type:jwt
```

### Rules

- The subject token must be an Identvia access token issued to you, or one whose aud names you. The person’s connection to the original app must still be active.
- Scopes can only shrink. When you don’t send scope, you get the original scopes minus offline\_access. offline\_access is never exchanged, and no refresh token or ID token is issued.
- audience (or resource) must be an active Identvia client or the Identvia MCP resource. Anything else returns invalid\_target. When the audience is another client, sub is the person’s pairwise identifier for that client.
- The new token lives for at most 10 minutes and never longer than the token it came from. Chains are limited to 3 hops.
- Revoking the original token, or the person disconnecting the app, switches off every token derived from it straight away (introspection returns active: false).
- An invalid subject or actor token returns invalid\_request, as RFC 8693 §2.2.2 requires.

### Actor tokens

To name the agent, send an actor token: a JWT signed (ES256 or RS256) by an agent key the person registered under *Agents* in their account.

JSON

```
header:  { "alg": "ES256", "kid": "<RFC 7638 JWK thumbprint of the agent key>" }
payload: { "sub": "<harness id shown in the person's Agents page>",
           "aud": "https://id.identvia.com",
           "iat": 1700000000, "exp": 1700000120,
           "jti": "<unique, single use>" }
```

The token must expire within 5 minutes, each jti works once, and blocked agents are refused. The issued token carries the standard act claim; earlier actors are nested inside it:

JSON

```
{ "sub": "…", "aud": "oid_…", "scope": "openid email",
  "act": { "sub": "harness-123", "agent_tier": "registered",
           "act": { "sub": "oid_first_app" } } }
```

Per RFC 8693 §4.1, base access decisions on the top-level claims and the *current* actor only; nested actors are history.

## Rich authorization requests (RFC 9396)

Send authorization\_details (a JSON array) with the authorization request. Accepted types on this server: agent\_task.

JSON

```
[{ "type": "agent_task",
   "actions": ["read", "summarize"],
   "locations": ["https://api.example.com/inbox"],
   "datatypes": ["messages"],
   "identifier": "folder-42" }]
```

- The person always sees the specific request on the consent screen, even if they trusted your app before.
- The common fields locations, actions, datatypes and privileges must be arrays of strings; identifier must be a string. At most 10 entries and 4 KB.
- The granted details come back in the token response, in the access token’s authorization\_details claim, in introspection and after refresh.
- Errors use invalid\_authorization\_details.
- A token exchange inherits the details, or can narrow them; it can’t widen them or add new ones.

## CIBA: approve on the person’s own device

For a call center, a kiosk or a back-office agent that knows who the person is but has no browser session with them. Choose **Poll** or **Ping** in the Delegation card.

HTTP

```
POST /oauth/bc-authorize
Authorization: Basic base64(client_id:client_secret)

scope=openid email
&login_hint=person@example.com
&binding_message=Desk 4 · code 7Q2K
&requested_expiry=120

→ 200 { "auth_req_id": "…", "expires_in": 120, "interval": 5 }
```

- login\_hint must be an email address. id\_token\_hint, login\_hint\_token, signed requests (request) and user\_code aren’t supported and return invalid\_request.
- The response looks the same whether or not the email belongs to someone, so it can’t be used to find accounts. Unknown people simply never approve.
- Show the same binding\_message on your screen; the person sees it in their Identvia inbox and email, labeled as a message from your app, and checks they match. Up to 48 characters: letters, numbers, spaces and basic punctuation (- \_ . , : # ( ) · !). Links, domain names and email addresses are rejected with invalid\_binding\_message. Each person gets at most a few requests per hour across all apps.
- The person gets an email with a link to their inbox, never an approve link. Approving needs a fresh passkey or authenticator-app check.

### Poll mode

HTTP

```
POST /oauth/token
grant_type=urn:openid:params:grant-type:ciba&auth_req_id=…

→ 400 authorization_pending | slow_down | access_denied | expired_token
→ 200 { "access_token": "…", "id_token": "…", "refresh_token": "…" }
```

Wait at least interval seconds between polls. Polling too fast returns slow\_down and adds 5 seconds to your interval. An auth\_req\_id can be redeemed once.

### Ping mode

Register an https notification endpoint on your app’s own domain, then send a client\_notification\_token with each request. When the person decides, Identvia POSTs {"auth\_req\_id": "…"} to that endpoint with Authorization: Bearer <your client\_notification\_token>. Check the token, answer 204, then call the token endpoint as in poll mode. Push mode isn’t offered.

## PHP SDK

PHP

```
// Token exchange: a narrower token for another app, optionally naming the agent
$t = $identvia->tokenExchange($accessToken, audience: 'oid_other_app', scope: 'openid email', actorToken: $agentJwt);
$t->accessToken;              // no refresh token, short-lived

// CIBA (poll)
$req = $identvia->cibaAuthorize('person@example.com', scope: 'email', bindingMessage: 'Desk 4 · 7Q2K');
$interval = $req['interval'];
while (($tokens = $identvia->cibaPoll($req['auth_req_id'], $interval)) === null) { sleep($interval); }
// throws TokenException with error access_denied or expired_token when it's over

// CIBA (ping): in your notification endpoint
$id = Identvia\Sdk\Identvia::verifyCibaPing($_SERVER['HTTP_AUTHORIZATION'] ?? '', file_get_contents('php://input'), $storedToken);

// Rich authorization request on sign-in
$identvia->redirectToSignIn(['authorization_details' => [['type' => 'agent_task', 'actions' => ['read']]]]);
```

## Discovery

When enabled, discovery lists urn:ietf:params:oauth:grant-type:token-exchange and urn:openid:params:grant-type:ciba in grant\_types\_supported, plus authorization\_details\_types\_supported, backchannel\_authentication\_endpoint, backchannel\_token\_delivery\_modes\_supported and backchannel\_user\_code\_parameter\_supported: false.

Which IETF agent-identity drafts we follow, and how closely, is listed in docs/standards.md in the download.

---
Source: https://id.identvia.com/developers/docs/delegation
