View as Markdown

Identify · Guide

Require a human

Require the person behind an agent to approve a request before your site serves it. A require_intent rule answers with 401 and a ProvenanceIntent challenge; a well-behaved agent asks its person through Authorize, gets an intent token bound to that exact request, and retries with it.

Before you begin: run the middleware and set your route map so the actions you protect have names.

This is the same challenge a store's checkout step-up uses, so an agent runs one code path for both. Its grammar is on the approval challenge.

1. Add a require_intent rule

{
  "rules": [
    {
      "id": "human-for-account-change",
      "when": [{ "fact": "action", "op": "in", "value": ["login", "account_change"] }],
      "then": { "action": "require_intent", "binding": "request", "require": { "biometric": true } }
    }
  ]
}
bindingThe approval bindsUse it for
orderYour order: id, total, currency, merchant, origin, cart linescheckout. The middleware calls your orderFor(req) to get it.
requestThe origin, action, method and path, plus fields you addlogin, account_change and anything else

require.biometric and require.min_tier set the approval strength the retry must show.

On a request binding, require.approval defaults to true: the retry must carry the person's own approval of this request, made with a passkey or the device's biometric. Set "require": { "approval": false } to accept the agent's own bound token instead. That proves the agent asked Authorize for this exact request; it doesn't prove a person saw it. On an order binding, set approval: true to require the same.

2. What the agent receives

HTTP/1.1 401 Unauthorized
WWW-Authenticate: ProvenanceIntent realm="quillstack.example", action="account_change", binding="request"
Content-Type: application/problem+json
Cache-Control: no-store

{
  "type": "https://provenanceauth.com/problems/approval-required",
  "title": "Approval required",
  "status": 401,
  "detail": "This site asks the person behind the agent to approve this exact request.",
  "approval_request": {
    "object": "approval_request",
    "version": "2026-10-24",
    "action": "account_change",
    "binding": { "kind": "request", "origin": "https://quillstack.example", "action": "account_change", "method": "POST", "path": "/account/email" },
    "display": { "merchant_name": "Quillstack" },
    "require": { "approval": true, "biometric": true },
    "expires_at": "2026-10-25T19:30:00.000Z",
    "retry": { "method": "POST", "url": "https://quillstack.example/account/email", "header": "Provenance-Intent" }
  }
}

The challenge names no person and carries nothing a person entered.

3. The agent authorizes and retries

checkoutFetch from @provenanceauth/agent-adapters handles both bindings. For binding="request" it authorizes approval_request.binding as the action payload, with the site's origin as the token's audience, and replays the request with Provenance-Intent:

import { checkoutFetch, signedFetch } from "@provenanceauth/agent-adapters";

const shop = checkoutFetch({ client: prov, deviceId, agentSessionId: "pantry-1", agentId, fetch: signedFetch({ key, agentId }) });
await shop("https://quillstack.example/account/email", { method: "POST", body: JSON.stringify({ email: "new@example.com" }) });

When the challenge says require.approval: true, the agent sends approval with transport: "request". Authorize opens an approval for the person: the approval embed or your mandate.approval.created webhook in-house, or a text to someone outside your team when you pass approverLinkId. The person sees the site, the action and the exact method and path, and approves with face, fingerprint or passkey. Until then the call throws a pending error; call it again after they approve, and it gets the token.

The same call with the Node SDK directly:

import { authorizeRequestChallenge, parseRequestChallenge } from "@provenanceauth/sdk";

const challenge = await parseRequestChallenge(res);
const authorize = authorizeRequestChallenge(prov.intent, { deviceId, agentSessionId: "pantry-1", agentId });
const outcome = await authorize({ approvalRequest: challenge.approvalRequest, merchantOrigin: "https://quillstack.example", challenge });
// outcome.status: "approval_pending" until the person approves, then "approved" with outcome.intentToken

4. Your site allows the retry

The middleware rebuilds the binding from the retried request and checks the token: its signature and expiry, its audience, its payload_hash against the binding, the person's approval (human.approval_id, made with a passkey or the device's biometric) and the strength you asked for. When it holds, the decision is allow, human.backed is true and human.pseudonym names the person at your site only.

Agents on an SDK from before this default send an agent-only token, which gets intent_reason: "approval_required". While they upgrade, set require: { approval: false } on the rule.

A token for another path, another site or a weaker approval leaves the decision at require_intent and the challenge is sent again, with human.intent_reason saying why.

5. Agents with a standing grant

An agent can present a grant in Provenance-Mandate instead of a per-request token. The middleware reads the grant's own constraints:

ConstraintPasses when
allowed_counterpartiesIt is null, or it lists your origin, your host or your account ID
allowed_action_typesIt is empty, or it lists the action your route map names
expires_at and the token's expBoth are in the future

A grant's subject is per token, so a grant-backed verdict has human.pseudonym: null. A grant is the person's standing permission, not their approval of this request, so it counts only on a rule with require: { approval: false }; otherwise it gets approval_required. A grant in Provenance-Intent never satisfies a challenge: that header carries an approval of one request. human.source says which header the token came from.

The hosted check also confirms the grant and the token are not revoked, and checks every grant above it. A sub-agent's grant stops when a grant it was delegated from is revoked or expired, or when an agent holding one is suspended. An intent token authorized under a grant stops with that grant's chain the same way.

Errors you might see

SymptomCauseFix
intent_reason: "audience_mismatch"The token names another site as its audienceThe agent must authorize for the origin it calls.
intent_reason: "payload_hash_mismatch"The token binds a different requestThe agent must authorize the challenge's binding unchanged.
intent_reason: "approval_required"The rule wants a person, and the token carries no approval made with a passkey or biometricThe agent authorizes with approval (current SDKs do), or set require: { approval: false }.
intent_reason: "grant_not_applicable"A grant arrived in Provenance-Intent, or its counterparties or action types don't include this requestSend the grant in Provenance-Mandate, or authorize the challenge's binding.
intent_reason: "token_revoked"The person or operator revoked the token or the grant, or a grant above it in the chain is revoked, expired or held by a suspended agentThe agent asks its person again.
intent_reason: "approval_too_weak"The approval lacked the biometric or device tier your rule requiresThe agent's person approves again on a qualifying device.
Checkout challenges use binding="request"The middleware had no order for the requestPass orderFor so checkouts bind the order.

See also