Join our Newsletter — 33% off our NHI Course
Home› Glossary› Agentic AI & Autonomous Identity› On-behalf-of oauth
Agentic AI & Autonomous Identity

On-behalf-of oauth

← Back to Glossary
By NHI Mgmt Group Updated November 5, 2026 Domain: Agentic AI & Autonomous Identity

A delegation pattern where one service requests a downstream token for a user without exposing the user’s credential to the calling agent. In agentic systems, this keeps the identity boundary inside the server layer and prevents the model or tool runtime from becoming the holder of sensitive credentials.

How on-behalf-of OAuth works

On-behalf-of OAuth is a delegation pattern, not a new login method. One service receives a user-backed token, then asks the authorization server for a downstream token that represents the same user but is scoped for the next API or resource. The calling service never needs to handle the user’s credential directly.

This separation matters because the service becomes the broker of delegated access, while the user remains the principal being represented. The downstream token can be narrower than the original grant, which helps preserve intent, reduce overreach and keep sensitive authentication material out of the client or runtime that is doing the calling.

Why this pattern exists

Modern systems often need one component to act for a user without turning that component into a credential holder. On-behalf-of flows solve that by exchanging a token rather than forwarding passwords, refresh tokens or other long-lived secrets through every hop. In practice, that allows server-side policy to decide what the intermediary may request next.

This is especially useful when a front-end, middleware layer, AI agent or orchestration service must call a downstream API under the user’s authority. The pattern preserves a clear boundary between user authentication and delegated authorization, which is one reason it is used in server-mediated access flows and chained service calls.

Delegation, impersonation and token scope

People often use “on-behalf-of” and “impersonation” loosely, but they are not the same idea. A well-formed delegation flow should preserve who the user is, who is acting, and what the delegated token may do. That usually means the token contains enough context for the downstream service to make an authorization decision without exposing the original credential.

The practical control point is scope and audience. The exchanged token should be issued only for the intended downstream resource, and it should encode the acting relationship clearly enough that resource servers can distinguish delegated access from direct application access. For that reason, token exchange specifications and audience restriction are central to secure design.

Where the security boundary sits

The strongest security property of on-behalf-of OAuth is that the server layer, not the calling tool or model runtime, stays inside the trust boundary for credential handling. That reduces the blast radius of UI clients, plugins and agent runtimes that only need to request or relay delegated access, not possess reusable user secrets.

For standards context, the core OAuth model is defined in RFC 6749: The OAuth 2.0 Authorization Framework, while delegated token exchange is defined in RFC 8693: OAuth 2.0 Token Exchange. The same pattern is also explained in NHIMG’s OAuth Token Exchange and Delegation Guide, which covers actor tokens, subject tokens and downscoping.

Security implications for agentic and service-to-service systems

In agentic systems, on-behalf-of OAuth helps prevent the agent or tool runtime from becoming a durable credential sink. That is important because once a runtime can hold long-lived secrets or broad tokens, compromise of the runtime can become equivalent to compromise of the user’s delegated access path. Keeping delegation server-side narrows that risk.

The same model is useful in service-to-service architectures where one service needs user context but should not inherit the user’s full access. Done well, it limits token reuse, reduces accidental privilege carryover and supports safer chaining of APIs, brokers and downstream resource servers.

Why practitioners should care: The design choice affects where credentials live, how much authority the intermediary receives and how easily a compromised client can turn a delegated session into broader access. Treat the exchange boundary as a security boundary, not just an implementation detail.

Common misunderstanding: On-behalf-of OAuth does not mean “the service can do anything the user can do.” The delegated token should still be constrained to the specific downstream purpose, with audience and scope checked by the receiving service.

Risk and Threat Considerations

On-behalf-of flows concentrate trust in the token exchange boundary, so mistakes there can convert intended delegation into overbroad access or token replay. The main danger is not the pattern itself, but weak scope design, poor audience control, or a client runtime that is allowed to see more than it should.

Failure mechanism: If the intermediary can obtain, store, or forward tokens too broadly, an attacker who compromises that layer can reuse delegated access, pivot into downstream APIs, or abuse the user context without ever stealing the original credential.

Impact: The result can be unauthorized API access, privilege expansion across service chains, and harder post-incident containment because the attacker is operating through apparently legitimate delegated tokens rather than through an obvious password theft event.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-9 — Service Identification and AuthenticationCovers service and API authentication in delegated server-to-server token flows.
AC-3 — Access EnforcementApplies to downstream enforcement of delegated scopes and audiences.
IA-5 — Authenticator ManagementApplies where the flow depends on protecting and rotating client credentials and related secrets.
Recommendation — Use IA-9 to authenticate services that exchange and consume delegated tokens. Enforce downstream authorization so exchanged tokens only grant approved access. Manage and rotate client secrets and token-signing material used in delegation flows.
OWASP ASVSV10 — OAuth and OIDCDirectly covers OAuth flows, token handling and authorization code security.
Recommendation — Verify OAuth and OIDC flow requirements to prevent token misuse in delegated access.
OWASP API Security Top 10API2 — Broken AuthenticationDelegated API access depends on correct token authentication and validation.
Recommendation — Validate tokens rigorously so delegated API calls cannot be spoofed or replayed.

Practitioner Guidance

Governance implication: Define which services are allowed to exchange tokens on behalf of users, and make the downstream resource the authority that enforces the resulting scope. That keeps delegation policy in the server layer, where it can be reviewed and constrained centrally.

What to watch for: Be cautious when a design starts forwarding bearer tokens between components, especially in agent runtimes, middleware or integration hubs. A safer pattern is one exchange per intended downstream audience, with no unnecessary token exposure to the caller.

Practitioner takeaway: If the caller only needs to request delegated access, it should not become the custodian of the user’s reusable credentials.

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.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 5, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org