Skip to content

Add force_base_channel option to get_conversation_reference for M365 Copilot Web OAuth #391

@MattB-msft

Description

@MattB-msft

Summary

Port of Agents-for-net#828 to Python.

The .NET SDK added a forceBaseChannel parameter to GetConversationReference() to fix OAuth sign-in behavior in M365 Copilot Web (see Agents-for-net#827). When M365 Copilot Web sends activities, the channelId is a composite identifier. For OAuth token exchange, the base channel must be used instead.

Changes Needed

libraries/microsoft-agents-activity/microsoft_agents/activity/activity.py

  • Add optional force_base_channel: bool | None = None parameter to get_conversation_reference()
  • When True, use the base channel (e.g. self.channel_id.channel or equivalent) instead of the raw channel_id string

libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/connector/client/user_token_client.py

  • Update OAuth token exchange code paths to call get_conversation_reference(force_base_channel=True) — matching the behavior added to RestUserTokenClient.cs in the .NET PR

Reference

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions