botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Error in web chat "Authorization for Microsoft App ID failed with status code Forbidden"

Open manojkota opened this issue 10 years ago • 19 comments

I have integrated my bot with Facebook, skype & web chat. Fb & Skype are working fine. But I am getting forbidden exception for web chat. It is not sending the replies. I have updated the framework to 3.1.0 as well.

Thanks in advance.

manojkota avatar Aug 12 '16 05:08 manojkota

Are you using the Direct Line secret in your web chat url ?

danmarshall avatar Aug 12 '16 06:08 danmarshall

Yes...I'm using key mentioned in the embedded code.

manojkota avatar Aug 12 '16 07:08 manojkota

can you tell me your bot id?

danmarshall avatar Aug 12 '16 17:08 danmarshall

msboombot

manojkota avatar Aug 14 '16 23:08 manojkota

Hi,

I'm still getting the same error. Any update on this issue.

manojkota avatar Aug 22 '16 02:08 manojkota

Hello, thanks for your patience. I can see the issue occurring. Are you using C# or Node.js ?

danmarshall avatar Aug 22 '16 18:08 danmarshall

I am facing this same issue while trying to update my bot, it fails on skype and telegram, haven't tested other channels. My bot is in C#

fercom avatar Aug 22 '16 20:08 fercom

Hi @manojkota - can you share a code sample of your dialog structure and how you are sending messages?

danmarshall avatar Aug 22 '16 21:08 danmarshall

I'm generating random messages based on internal process. But my basic implementation is this.

var reply = await connector.Conversations.SendToConversationAsync(item);

manojkota avatar Aug 22 '16 23:08 manojkota

I'm having the same issues :( BotID "eldur3"

liiver avatar Aug 25 '16 18:08 liiver

Thanks @manojkota and @liiver - at this point it would be very helpful for us to diagnose your issue if you can provide a more complete code sample which reproduces the issue. We cannot reproduce the scenario so if you can isolate a code block that will be valuable for us.

danmarshall avatar Aug 25 '16 19:08 danmarshall

For me it seems similas as with @manojkota

So debugging it also locally, the exeption is either thrown in await connector.Conversations.ReplyToActivityAsync(reply); or await Conversation.SendAsync(activity, () => new MainDialog()); i.e. it It does not seem to go onwards from there to my MainDialog() which is a LuisDialog

But in the first example, there is no LuisDIalog involved, but the same error. Seem bug-ish to me. Using BotBuilder 3.2.0

Code example:

if (activity.Type == ActivityTypes.Message) { await Conversation.SendAsync(activity, () => new MainDialog()); } else if (activity.Type == ActivityTypes.ConversationUpdate) { ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl)); Activity reply = activity.CreateReply(activity.From.Name); await connector.Conversations.ReplyToActivityAsync(reply); }

liiver avatar Aug 25 '16 21:08 liiver

any updates on this one? Seems to be some bug then or?

liiver avatar Aug 29 '16 14:08 liiver

@manojkota and @liiver it would be good if you can share the code that repros this. Creating a repo with the code that have a repro for this issue will help us diagnose this issue.

msft-shahins avatar Aug 30 '16 23:08 msft-shahins

Mine is a private repository. I can't provide access to it.

manojkota avatar Sep 01 '16 00:09 manojkota

@manojkota would be good if you can create a project that has the minimal code to repro this issue.

msft-shahins avatar Sep 01 '16 01:09 msft-shahins

@msft-shahins, somehow the issue is resolved on its own. Thank you for your help.

manojkota avatar Sep 06 '16 05:09 manojkota

I have the same issue. I have a well working bot that replies to messages in Slack and Skype. for my Slack users the bot also sends scheduled message every morning. I have a very simple code that once worked and than it started giving the "Authorization for Microsoft App ID ... failed with status code Forbidden" error .

Using latest bot framework NuGet Microsoft.Bot.Builder 3.5. I triple checked I have my MicrosoftAppId and MicrosoftAppPassword in the app config file, also tried to specify explicitly in the code below. Same error.

Here is the test code that I thought should work:

private void button1_Click(object sender, EventArgs e) { var connector = new ConnectorClient(new Uri("https://slack.botframework.com"), ".. my app id removed here...", "...removed password..."); var conversation = new ConversationAccount(true, "B0GRPT96X:T04EVT5HU:C0L57SCKY"); var botAccount = new ChannelAccount("B0GRPT96X:T04EVT5HU", "grasp"); IMessageActivity message = Activity.CreateMessageActivity(); message.From = botAccount; message.Conversation = conversation; message.ChannelId = "slack"; message.Text = "some text"; message.Locale = "en-En"; connector.Conversations.SendToConversation((Activity)message); }

If I call

bool t = MicrosoftAppCredentials.IsTrustedServiceUrl("https://slack.botframework.com");

it returns false.

Thanks for your help.

gcsonka avatar Jan 22 '17 23:01 gcsonka

@danmarshall , @msft-shahins - I just noticed this issue was closed. Can you provide any guidance on the error I still get? Or should I open a new issue. thanks

gcsonka avatar Jan 25 '17 03:01 gcsonka