Skip to content

Add JWT decoding to agentic message handling#905

Merged
benbrown merged 4 commits intomainfrom
users/mbarbour/addJWTDecodeToAgenticIDSample
Mar 10, 2026
Merged

Add JWT decoding to agentic message handling#905
benbrown merged 4 commits intomainfrom
users/mbarbour/addJWTDecodeToAgenticIDSample

Conversation

@MattB-msft
Copy link
Copy Markdown
Member

This pull request updates the AgenticAI agent in test-agents/agentic-ai/src/index.ts to enhance the handling and display of user authentication token details. The main changes focus on decoding JWT tokens to extract user information and simplifying activity handler registration.

Authentication and user info extraction:

  • Added JWT decoding using the jsonwebtoken library to extract user details (name, upn, oid, tid) from the authentication token in the agentic handler, and included these details in the bot's response message. [1] [2]

Activity handler registration simplification:

  • Removed unused parameters (true/false for useToken) from the onActivity method calls for both agentic and echo handlers, streamlining the activity registration logic.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 enhances the AgenticAI test agent to display decoded JWT user information from authentication tokens. The changes introduce JWT decoding capabilities and simplify the activity handler registration by removing an unused parameter.

Changes:

  • Added JWT decoding to extract user claims (name, upn, oid, tid) from authentication tokens
  • Simplified activity handler registration by removing the isAgenticRoute boolean parameter from onActivity calls

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test-agents/agentic-ai/src/index.ts Outdated
Comment thread test-agents/agentic-ai/src/index.ts Outdated
Comment thread test-agents/agentic-ai/src/index.ts
Comment thread test-agents/agentic-ai/src/index.ts Outdated
Comment thread test-agents/agentic-ai/src/index.ts
Comment thread test-agents/agentic-ai/src/index.ts
@benbrown benbrown merged commit 609a1a1 into main Mar 10, 2026
8 checks passed
@benbrown benbrown deleted the users/mbarbour/addJWTDecodeToAgenticIDSample branch March 10, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants