Forum Discussion
Moarles
Feb 22, 2022Copper Contributor
Unauthorized request - Bot in Azure
I am trying to test my Teams Bot in Teams application. I validated and added bot to my team. Look like I need an Azure app service to run the, so I deployed the app to Azure. But the bot in teams, nor 'Test in Webchat' in Azure bot doesn't work. I followed probably all guides, including troubleshooting and in the Azure Bot resource I can see:
There was an error sending this message to your bot: HTTP status code Unauthorized
In App service Log Stream I could see:
HTTP Error 401.0 - Unauthorized
You do not have permission to view this directory or page.
Most likely causes:
- The authenticated user does not have access to a resource needed to process the request.
Things you can try:
- Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module AspNetCoreModuleV2 |
Notification ExecuteRequestHandler |
Handler aspNetCore |
Error Code 0x00000000 |
Requested URL https://GraphInterfaceService:80/api/messages |
Physical Path C:\home\site\wwwroot\api\messages |
Logon Method Anonymous |
Logon User Anonymous |
I checked Ms App ID and client secret. In appsettings.json, Azure App Registration and in OAuth connection in Azure Bot are all the same. The bot is working on localhost with emulator with and without authorization.
We have another bot already running with Teams. I noticed that there is the same Ms App ID in Azure Bot and App registration. Is that as it should be? The bot described above have different ID in Azure Bot resource and App registration. I was trying to find if I can make it, but without success.
Frankly speaking, I don't know what is this address:
GraphInterfaceService is name of App Service in Azure, but endpoint URL is different. And I added /api/messages/ to it.
Furthermore, when I am trying to add "Chat.ReadWrite.All" in OAuth setting sopces (Chat.ReadWrite.All exists in App registration!) it shows me this error on Test connection (but does it matter what scopes are in here? Don't know if they are used to obtain those scopes for general traffic):
error: {
code: "ServiceError",
message: "Missing required query string parameter: code. Url = https://token.botframework.com/.auth/web/redirect?error=invalid_client&error_description=AADSTS650053%3a+The+application+%27GraphInterfaceAuthentication%27+asked+for+scope+%27Chat.ReadWrite.All%27+that+doesn%27t+exist+on+the+resource+%2700000003-0000-0000-c000-000000000000%27.+Contact+the+app+vendor.%0d%0aTrace+ID%3a+8ecdfbf8-1416-4c68-a28a-66848abad800%0d%0aCorrelation+ID%3a+7f0cd7a4-0a36-4058-a286-57aa20a4059b%0d%0aTimestamp%3a+2022-02-22+00%3a58%3a16Z&state=377673302917459099fe22675ac76be5"
}
No RepliesBe the first to reply