-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Authorization for Microsoft App ID failed with status code Unauthorized and reason phrase 'Unauthorized' #2575
Comments
hi @sogeg - can you provide more details about your issue? Environment
IssueWhat the issue is, in broad strokes. Link to Stack Overflow post. Example CodeThe code snippet or complete bot example (preferred) that demonstrates the issue. Steps to ReproducePlease provide the shortest amount of steps to reproduce your issue. Expected BehaviorWhat you expected to happen. Actual ResultsWhat actually happened. Please give examples and support it with screenshots, copied output or error messages. |
Hello @nwhitmont thank you for your reply. The Deployment Environment is Windows 2012 R2, IIS Server Issue: Step 1: I save conversation info after I receive a message from the user.
Step 2: I use the SkypeConversation object to send a proactive message (bot triggered)
In the first hours everything works fine. However after about 20H I get the following exception: System.UnauthorizedAccessException: Authorization for Microsoft App ID 344dd93f-9056-4b47-9f21-28704ffabb87 failed with status code Unauthorized and reason phrase 'Unauthorized' ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at Microsoft.Bot.Connector.JwtTokenRefresher.d__2.MoveNext() --- End of inner exception stack trace --- at Microsoft.Bot.Connector.JwtTokenRefresher.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.Bot.Connector.Conversations.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.ConversationsExtensions.d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at EscapeAll.Skype.Utilities.d__0.MoveNext() in C:\Users\G\Documents\Visual Studio 2015\Projects\Esc\XXXX\Skype\Utilities.cs:line 25 What I expected was to continue to send messages as in the first 20Hours. Thank you for your help :) |
Maybe I need offline_access scope? I noticed that when I send a message to the skype account, everything works again |
Proactively messages from another server is big problem |
@sogeg are you still having this problem in the newest version of the SDK 3.8.1 at the time of writing this? |
I am also having the same problem. I am on version 3.8.1 of the SDK. |
I can repro the same behavior in the above case plus after every deploy (or restart) of my web application - I am on version 3.8.1 as well. |
You need to add a call to |
@EricDahlvang Thanks! |
Hi I am having the same problem. I have already used MicrosoftAppCredentials.TrustServiceUrl(serviceUrl); |
@sakshisa27 Please open a new issue, describing your problem in detail. This issue is closed. |
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl); did it for me |
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl); |
Hello!
I use my bot to send proactive messages. To do this I save conversation info and I use connector.Conversations.SendToConversationAsync to send the proactive message when required.
Here is my code:
At first the SendToConversationAsync works fine. But after about 20 hours (not sure about the exact time) I get:
Authorization for Microsoft App ID ### failed with status code Unauthorized and reason phrase 'Unauthorized'
Any ideas?Is there a time window?
The text was updated successfully, but these errors were encountered: