Skip to content

Enhance PABot with dual OAuth and CompatTeamsInfo integration#417

Open
singhk97 wants to merge 2 commits intonext/corefrom
feature/pa-bot-compat-teams-info
Open

Enhance PABot with dual OAuth and CompatTeamsInfo integration#417
singhk97 wants to merge 2 commits intonext/corefrom
feature/pa-bot-compat-teams-info

Conversation

@singhk97
Copy link
Copy Markdown
Collaborator

@singhk97 singhk97 commented Apr 7, 2026

Summary

This PR enhances the PABot sample with dual OAuth authentication and CompatTeamsInfo integration, demonstrating advanced Teams bot capabilities.

Changes

Dual OAuth Authentication

  • ✅ Sequential authentication with two OAuth connections (graph and graph-2)
  • ✅ Connection names configurable via launchSettings.json (ConnectionName and SecondConnectionName)
  • ✅ Six-step waterfall dialog flow:
    1. Prompt for first connection (graph)
    2. Authenticate first connection
    3. Prompt for second connection (graph-2)
    4. Authenticate second connection and display user profile
    5. Ask user if they want to view tokens
    6. Display both tokens if requested
  • ✅ Enhanced logout to clear both OAuth connections

CompatTeamsInfo Integration

  • /member-info command: Uses CompatTeamsInfo.GetMemberAsync to retrieve and display:
    • Name, ID, AAD Object ID, User Principal Name, Email
  • /team-info command: Uses CompatTeamsInfo.GetTeamDetailsAsync to display:
    • Team Name, ID, AAD Group ID (only works in team context)
  • Enhanced OnMembersAddedAsync: Logs detailed member information when users join using GetMemberAsync

User Experience Improvements

  • /help command: Comprehensive help showing:
    • All available commands and their usage
    • Authentication flow explanation
    • Technical features overview
  • Updated welcome message: Includes all available commands including /help

Testing

The bot can be tested by:

  1. Starting a conversation with the bot
  2. Authenticating with both connections sequentially
  3. Testing commands: /help, /member-info, /team-info, /create-conversation
  4. Verifying logout clears both connections

Technical Details

Files Modified:

  • core/samples/PABot/Bots/TeamsBot.cs - Added commands and CompatTeamsInfo usage
  • core/samples/PABot/Dialogs/MainDialog.cs - Dual OAuth dialog flow and custom logout
  • core/samples/PABot/Program.cs - Switched to TeamsBot (from EchoBot)
  • core/samples/PABot/Properties/launchSettings.json - Added SecondConnectionName environment variable

🤖 Generated with Claude Code

singhk97 and others added 2 commits April 7, 2026 11:38
Features added:
- Dual OAuth authentication: Sequential authentication with two connections (graph and graph-2)
  - Connection names configurable via launchSettings.json
  - Both connections authenticated one after another before proceeding
  - Logout clears both OAuth connections

- CompatTeamsInfo integration:
  - Added /member-info command using CompatTeamsInfo.GetMemberAsync
  - Added /team-info command using CompatTeamsInfo.GetTeamDetailsAsync
  - Enhanced OnMembersAddedAsync to log detailed member info on join

- Help command:
  - Added /help command with comprehensive bot documentation
  - Lists all commands, authentication features, and usage instructions
  - Updated welcome message to include /help

- Dialog improvements:
  - MainDialog now supports two OAuth prompts (FirstOAuthPrompt, SecondOAuthPrompt)
  - Six-step waterfall dialog for sequential authentication
  - Both tokens stored and displayed when requested
  - Custom logout handler signs out from both connections

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@rido-min rido-min added the CORE label Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants