Amazon Web Services (AWS) has introduced a new capability within its Amazon Bedrock AgentCore platform, enabling AI agents to securely interact with enterprise APIs, specifically the ServiceNow REST API, while preserving the identity of the end-user. This advancement addresses a critical challenge in AI agent development: maintaining user identity throughout complex request chains to ensure proper auditing, enforce access controls, and uphold the principle of least privilege.
The Chenab Times has learned that the integration utilizes a token exchange mechanism facilitated by AgentCore Gateway, a component of Amazon Bedrock AgentCore. This gateway is configured to perform an on-behalf-of (OBO) token exchange with Microsoft Entra ID. This allows AI agents, powered by Amazon Bedrock, to authenticate and execute actions on behalf of users within ServiceNow, rather than appearing as the application itself. This functionality can be extended to other REST APIs protected by OAuth protocols.
The solution architecture involves three primary components: an AI agent application authenticated via Microsoft Entra ID, the AgentCore Gateway acting as a Model Context Protocol (MCP) server, and the ServiceNow REST API configured with an inbound OAuth integration tied to Microsoft Entra ID. When a user initiates an action, their identity is propagated through the gateway, which exchanges the agent’s token for one scoped to the ServiceNow API. ServiceNow then processes the request using the original user’s permissions.
This OBO token exchange ensures that when an agent calls the AgentCore Gateway, it presents a token with an audience claim specific to the agent. ServiceNow, however, requires a token with an audience claim matching its own API connector. AgentCore Gateway bridges this gap by sending the inbound token, agent credentials, and the target scope to the Microsoft Entra token endpoint. Coupled with the parameter requested_token_use: on_behalf_of, Entra issues a new token for the ServiceNow API, retaining the original user’s claims. This new token enables ServiceNow to identify the user and apply their specific access privileges.
Prerequisites for implementing this integration include an AWS account with AgentCore Gateway access, a Microsoft Entra ID tenant with permissions for application registration (requiring the Application Developer role), and administrative access to a ServiceNow instance to configure inbound OAuth integrations. Two Entra application registrations are necessary: one for the AI agent and another for the ServiceNow API connector.
The configuration process involves setting up application registrations in Microsoft Entra ID for both the ServiceNow API connector and the AI agent. For the ServiceNow API connector, an API scope named user_impersonation is exposed, which is requested by the OBO flow. The AI agent application registration requires a client secret for the gateway to use during the OBO exchange, and it must be granted API permissions to call the ServiceNow API connector application.
Within ServiceNow, an inbound integration is created in the System OAuth settings, utilizing the client ID of the ServiceNow API connector. An OpenID Connect (OIDC) provider configuration is established, linking to the Entra tenant’s metadata URL and mapping user claims, such as preferred_username, to the appropriate fields in ServiceNow. An authorization scope is then created to limit the agent’s access to specific ServiceNow APIs, such as the Table API.
The AgentCore Gateway is then configured to handle the OBO exchange natively. This involves creating an outbound auth configuration in AgentCore, specifying the agent’s client ID and secret, and the Entra discovery URL. The gateway is set to use a JWT authorization grant for token exchange. Crucially, when creating the gateway, the MCP version 2025-11-25 must be selected, as earlier versions do not support native OBO functionality. The inbound identity for the gateway is configured using the agent’s application registration.
Adding a target to the gateway involves defining the ServiceNow REST endpoint and providing an OpenAPI specification. The configuration for the target includes selecting OAuth as the outbound identity provider and pointing to the outbound auth configuration created earlier. Under additional configurations, a token exchange grant is set up with the ServiceNow API connector’s scope and the essential custom parameter requested_token_use: on_behalf_of. This parameter ensures that Microsoft Entra ID performs the OBO exchange.
Once configured, the AgentCore Gateway transparently handles the token exchange on each request without requiring custom code. The process involves receiving the agent’s JWT, exchanging it with Entra for a ServiceNow-scoped token that preserves user claims, and forwarding the request with the authenticated token to ServiceNow. Troubleshooting authentication errors typically involves verifying user claim mapping in ServiceNow, ensuring auth scope permissions, and confirming API permissions in Entra.
This native OBO support in AgentCore Gateway streamlines the integration process, eliminating the need for custom code and enhancing the security and auditability of AI agent interactions with enterprise systems like ServiceNow.
❤️ Support Independent Journalism
Your contribution keeps our reporting free, fearless, and accessible to everyone.
Or make a one-time donation
Secure via Razorpay • 12 monthly payments • Cancel anytime before next cycle


(We don't allow anyone to copy content. For Copyright or Use of Content related questions, visit here.)

The Chenab Times News Desk

