1
votes

I am developing an Azure bot for Microsoft teams, using Azure Bot Service, Bot registration channel setup. The messaging endpoint is an App Service that is authenticated with AAD login. Could some please help me understand how to call this authenticated endpoint from a bot? currently, I am testing it on Webchat and I get a 401 unauthorized error. I tried configuring the Oauth Setting in the bot as per this, but still getting 401. Could someone please point to any concepts and documentation required here.

2
Did you test the bot in the emulator after adding the connectionName in .env? If it works then check whether you have added the same in the Azure Bot Service.Rajesh Sitaraman
Why can't you just remove the AAD authentication? I don't know how you can get passed that security using web requests, which Microsoft bots depend on.AskYous

2 Answers

1
votes

There is no need to enable the App service Authentication. Just follow this article to add authentication to your bot via Azure Bot service. Then logon is required when you use the bot.

Reference:

Azure AD integration with Bot Framework / teams

1
votes

Microsoft Teams behaves somewhat differently than other channels in regards to OAuth and requires a few changes to properly implement authentication. Specifically an Invoke Activity is sent to the bot rather than the Event Activity used by other channels. This Invoke Activity must be forwarded to the dialog if the OAuthPrompt is being used. This is done by subclassing the TeamsActivityHandler and implementing handleTeamsSigninVerifyState. It is best advised to make use of the 46.teams-auth sample to set up OAuth in Teams.

Hope this helps.