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
Summary
Port of Agents-for-net#828 to Python.
The .NET SDK added a
forceBaseChannelparameter toGetConversationReference()to fix OAuth sign-in behavior in M365 Copilot Web (see Agents-for-net#827). When M365 Copilot Web sends activities, thechannelIdis a composite identifier. For OAuth token exchange, the base channel must be used instead.Changes Needed
libraries/microsoft-agents-activity/microsoft_agents/activity/activity.pyforce_base_channel: bool | None = Noneparameter toget_conversation_reference()True, use the base channel (e.g.self.channel_id.channelor equivalent) instead of the rawchannel_idstringlibraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/connector/client/user_token_client.pyget_conversation_reference(force_base_channel=True)— matching the behavior added toRestUserTokenClient.csin the .NET PRReference