Pass authHandlerName to Authorization.exchangeToken - #67
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the authentication flow to pass authHandlerName to the Authorization.exchangeToken method instead of hardcoding it as 'agentic', and introduces dynamic agent identity resolution from tokens rather than requiring an explicit agentUserId parameter.
Key Changes:
- Added
authHandlerNameparameter to the token exchange flow, making authentication handler configurable - Introduced a new
Utilityclass inagents-a365-runtimeto resolve agent identity dynamically from JWT tokens or turn context - Removed the
agentUserIdparameter from MCP tool registration methods, replacing it with runtime identity resolution
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/agents-a365-runtime/src/utility.ts | New utility class for decoding JWT tokens and resolving agent identity |
| packages/agents-a365-runtime/src/index.ts | Exports the new Utility class |
| packages/agents-a365-runtime/src/agentic-authorization-service.ts | Updated to accept authHandlerName parameter instead of hardcoding 'agentic' |
| packages/agents-a365-tooling-extensions-openai/src/McpToolRegistrationService.ts | Removed agentUserId parameter, added authHandlerName, uses dynamic identity resolution |
| packages/agents-a365-tooling-extensions-langchain/src/McpToolRegistrationService.ts | Same parameter updates as OpenAI extension |
| packages/agents-a365-tooling-extensions-claude/src/McpToolRegistrationService.ts | Same parameter updates as OpenAI extension |
| packages/agents-a365-tooling/src/McpToolServerConfigurationService.ts | Renamed parameter from agentUserId to agenticAppId for clarity |
| packages/agents-a365-tooling/src/Utility.ts | Updated documentation to reflect new terminology (agent identity vs digital worker) |
| tests-agent/openai-agent-auto-instrument-sample/src/OpenAIClient.ts | Updated to pass authHandlerName parameter |
| tests-agent/openai-agent-auto-instrument-sample/src/A365Agent.ts | Defines authHandlerName as 'agentic' and passes it to getClient |
| packages/agents-a365-runtime/package.json | Added jsonwebtoken dependency |
| pnpm-workspace.yaml | Added jsonwebtoken version override |
| pnpm-lock.yaml | Updated with jsonwebtoken and its types |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/agents-a365-tooling/src/Utility.ts:1
- The example URL uses a placeholder
{agenticAppId}in curly braces, but the actual implementation on line 81 uses string interpolation that would produce a literal value, not a placeholder. Update the example to show a concrete app ID value (e.g., 'agent-123') to match the pattern from line 73.
// Copyright (c) Microsoft Corporation.
rahuldevikar761
approved these changes
Nov 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.