Teams should verify the grant type, token audience, scopes, and whether the flow preserves a clear human principal behind the agent. They should also confirm the agent only receives a delegated token for the target API, not a broad bearer token, and that revocation, expiry, and audit logging cover each exchange step.
What to check before you let an agent use an on-behalf-of flow
The first check is whether the flow matches the trust relationship you actually intend. An on-behalf-of exchange should preserve the human principal behind the agent, so the delegated token reflects user intent rather than turning the agent into a broadly trusted bearer of access. That distinction matters because the security model changes from “the agent can act” to “the agent can act only within a tightly defined delegation.”
Just as important, the token should be targeted to the specific API or resource you expect. If the token audience is too broad, or the scopes are wider than the task needs, the exchange can silently expand the agent’s reach beyond the original request. In practice, teams should review the grant type, audience, scopes, and the exact consent or policy path that produces the downstream token.
How delegated tokens should behave in an AI agent design
A safe on-behalf-of design is usually narrow, time bound, and auditable. The agent should receive a delegated token for the target API, not a reusable bearer token that can be replayed elsewhere, and each exchange step should be attributable so you can reconstruct who asked for what and when. That audit trail is part of the control, not an optional logging layer added after the fact.
This is also where revocation and expiry decisions become operationally important. If the human session, the upstream grant, or the delegated token can outlive the task, the agent may continue to act after the original business purpose has ended. Teams should therefore treat token lifetime, refresh behaviour, and revocation propagation as part of the authorization design, not as an implementation detail left to the identity provider.
Where on-behalf-of flows go wrong in practice
Most failures come from delegation that is too broad or too implicit. Teams often assume the presence of a human login is enough, but the real question is whether the downstream token still carries a clear principal, a narrow audience, and task-appropriate scopes after the exchange. If any of those are weak, the agent may inherit more power than the workflow justifies.
Another common failure is treating the agent as if it were the user for every downstream call. That breaks the separation between user intent and machine execution and makes it harder to detect overreach, replay, or token misuse. A better pattern is to keep the delegated scope minimal, isolate the target API, and make each exchange step visible in logs and traces so abnormal use can be distinguished from legitimate automation.
Risk and Threat Considerations
On-behalf-of flows are attractive because they make delegation frictionless, but that same convenience can hide overbroad access, confused-deputy behaviour, and token replay. If the agent can obtain a token that is valid beyond the intended API or session, compromise of the agent or its context can become direct access to business systems.
Failure mechanism: The flow weakens when the exchanged token loses its tight binding to the human principal, the target audience, or the intended scopes, or when revocation and expiry do not propagate quickly enough across the exchange chain.
Impact: Attackers or misbehaving agents can reuse delegated access for unintended APIs, persist after the task ends, or hide their actions behind a legitimate human origin, which increases blast radius and slows incident response.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and OWASP API Security Top 10 address the attack and risk surface, while NIST SP 800-53 Rev 5 sets the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | Covers delegated access and privilege abuse in AI agents. |
| Recommendation — Constrain agent delegation so each action stays bound to the intended principal and scope. | ||
| OWASP API Security Top 10 | API2 — Broken Authentication | On-behalf-of flows depend on correct token issuance and audience binding for APIs. |
| Recommendation — Validate token audience and scopes before allowing the agent to call the API. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | Covers token lifecycle, expiry and revocation for delegated credentials. |
| AU-2 — Audit Events | The flow needs traceable exchange and use events for accountability. | |
| AC-6 — Least Privilege | Delegated scopes should be limited to the minimum access required by the agent. | |
| Recommendation — Enforce short lifetimes and revocation handling for delegated tokens. Log each token exchange and downstream use with principal and audience context. Limit delegated scopes to the minimum permissions needed for the target API. | ||
Practitioner Guidance
What to verify: Confirm that the token audience, scope set, and grant type are all explicitly constrained to the exact downstream API path the agent needs. If you cannot explain why a scope is present, treat it as excess privilege.
Decision rule: If the exchange produces a bearer token that could be useful outside the immediate task, redesign the flow before rollout. If the token cannot be tied back to a human principal and a single intended audience, the delegation model is too loose for production use.
What good looks like: Each exchange is traceable, short lived, and revocable, with logs that show the original principal, the delegated audience, and the downstream request path. The agent should be able to complete the task without retaining reusable access after the task is over.
Practitioner takeaway: The safest on-behalf-of design is the one that proves delegation without widening trust, because the moment the token stops being task-specific, it starts behaving like standing access.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org