-
Notifications
You must be signed in to change notification settings - Fork 20
Fix bearer token approach for Dotnet AF Sample #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the authentication approach for non-agentic requests in the .NET Agent Framework sample. The changes remove the OBO (On-Behalf-Of) authentication handler ("me") and replace it with a bearer token-based approach for development and testing scenarios like Playground and WebChat.
Changes:
- Removed "me" authentication handler configuration from appsettings.json
- Simplified ToolingManifest.json to include only mcp_MailTools MCP server
- Added TryGetBearerTokenForDevelopment method to support bearer token authentication from environment variables
- Updated message handling logic to differentiate between agentic (uses auth handler) and non-agentic flows (uses bearer token)
- Changed error handling to gracefully continue without MCP tools instead of throwing exceptions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| dotnet/agent-framework/sample-agent/appsettings.json | Removed "me" MsalUserAuthorization handler configuration to align with new bearer token approach |
| dotnet/agent-framework/sample-agent/ToolingManifest.json | Reduced MCP servers from 7 to 1 (mcp_MailTools only), simplifying the sample configuration |
| dotnet/agent-framework/sample-agent/Agent/MyAgent.cs | Added bearer token support via environment variables, refactored authentication flow to handle agentic vs non-agentic requests differently, and improved error handling for graceful degradation |
No description provided.