
Announcements
Integrating Copilot Studio with the Microsoft Bot Framework for manual authentication using Azure Active Directory v2 involves a few critical steps, and the issue you're facing might be due to missing configurations or nuances in the token exchange process. Here are the key steps, possible issues, and resolutions:
connectionName in the card. It must match the name of the OAuth Connection configured in the Azure Bot Channel Registration.https://token.botframework.com/api/oauth/signin?...) should be correctly generated by the Bot Framework.signInAudience in your Azure AD app is set correctly:
The signin/tokenExchange event is critical to this process. Verify the following:
type is set to "event"."signin/tokenExchange".value field should include the token and any additional information required by your bot. Your structure appears correct:
{
"type": "event",
"name": "signin/tokenExchange",
"value": { "token": "USER_AUTH_TOKEN" },
"from": { "id": "USER_ID", "name": "USER_NAME" },
"serviceUrl": "https://directline.botframework.com/"
}
signin/tokenExchange event, it might not have the logic implemented to process this event.signin/tokenExchange event in the Bot Framework SDK. For example, in a C# bot:
protected override async Task OnEventActivityAsync(ITurnContext<IEventActivity> turnContext, CancellationToken cancellationToken)
{
if (turnContext.Activity.Name == "signin/tokenExchange")
{
var tokenExchangeRequest = turnContext.Activity.Value as TokenExchangeRequest;
if (tokenExchangeRequest != null)
{
// Handle token exchange logic here
await turnContext.SendActivityAsync("Token exchange successful!");
}
}
}
connectionName in the OAuth card is not linked to a valid OAuth connection in the Azure Bot Channel Registration.signin/tokenExchange events if it relies solely on pre-defined connectors or logic.signin/tokenExchange event and forward the processed authentication state to Copilot Studio.serviceUrl in the event payload might not match the expected endpoint for your bot in the Direct Line channel.serviceUrl in the signin/tokenExchange event matches the URL for your bot's Direct Line channel. You can find this in the Azure Bot Channels Configuration.signin/tokenExchange event and verify whether it's being processed correctly.connectionName, Azure AD app settings, and Bot Framework channel configurations.signin/tokenExchange event is being triggered and handled properly.serviceUrl and Direct Line settings are consistent and correctly configured.Your configuration seems mostly correct, but the bot needs explicit logic to handle the signin/tokenExchange event. Ensure the bot processes this event correctly, and that all OAuth settings in Azure are aligned with your bot's implementation. If the issue persists, debugging the bot's activity logs and enabling diagnostic settings in Azure can provide more insight