microsoft / BotFramework-Services

Microsoft Bot Framework Services
Creative Commons Attribution 4.0 International
38 stars 11 forks source link

Bot Fails to Send Messages to Certain Skype Channels (AuthorizationError - Invalid JWT) #366

Closed alexandermujirishvili closed 1 week ago

alexandermujirishvili commented 1 week ago

I'm building a bot using the C# Bot Framework, and I'm encountering issues when sending messages to certain Skype channels. While my bot successfully sends messages to an initial test channel, it fails to send messages to newly created Skype channels, even though the same token acquisition and message-sending code is used in both cases.

For the newly created channels, I receive the following error response:

{
    "error": {
        "code": "AuthorizationError",
        "message": "Invalid JWT."
    }
}

I observed that the conversationId for the initial working channel ends with @thread.v2, while the conversationId for the failing channels ends with @thread.skype. I’m not sure if this is relevant, but I wanted to provide that observation.

var credentials = new MicrosoftAppCredentials(appId, appPassword)
{
    ChannelAuthTenant = tenantId
};

var activity = new Activity()
{
    Type = ActivityTypes.Message,
    Text = "This is a message from Bot Connector Client (.Net)"
};

using (var client = new ConnectorClient(new Uri("https://skype.botframework.com", UriKind.Absolute), credentials))
{
    await client.Conversations.SendToConversationAsync(conversationId, activity);
}

I don't see any channel-specific configuration available in the Azure portal.

I'm looking for guidance or a solution to resolve this issue.

alexandermujirishvili commented 1 week ago

Looks like this issue is only present for SingleTenant bots. I switched to Multitenant bot and it works as expected.