Azure AD integration with Bot Framework / teams

给你一囗甜甜゛ 提交于 2021-01-28 14:25:41

问题


Last week I've been looking at Bot framework Samples, honestly BotFx isn't my area of expertise. I was playing with these samples from the sample library:

18.bot-authentication
24.bot-authentication-msgraph
46.teams-auth

The required steps for making work each of them are almost the same, for #18 and make it work in the emulator this include:

  • Register the BotApp in Azure AD
  • Generate a Secret
  • Add the Redirect URI (as documented it should be: https://token.botframework.com/.auth/web/redirect)
  • Create an azure bot service
  • Customize the OAuth Connection Settings

  • Then in the solution Modify appsettings.json (sample values below)
    {
      "ConnectionName": "juank",
      "MicrosoftAppId": "cee1234562074c-1b3e-49b4-9e76-b727d73453454e018d",
      "MicrosoftAppPassword": "uxPdfgwo.JAYmgrtU]w5I7KdgxLZSJ.a[qtgtrFxYZ02"
    }
  • After that It's required to run the emulator and configure the following settings

  • Up to this point the bot works as expected

  • Then I type any... and it just doesn't work. I receive this answer from the bot :

  • And this data from the trace Operation returned an invalid status code 'Unauthorized'
{
  "channelId": "emulator",
  "conversation": {
    "id": "77631280-22e8-11ea-93e0-6dc9b0b41a7c|livechat"
  },
  "from": {
    "id": "61bab030-214b-11ea-9cf4-193735472c4b",
    "name": "Bot",
    "role": "bot"
  },
  "id": "ae429e60-22e8-11ea-9786-a543cb22378b",
  "label": "TurnError",
  "localTimestamp": "2019-12-20T00:22:13-05:00",
  "locale": "en-US",
  "name": "OnTurnError Trace",
  "recipient": {
    "id": "f6982626-923e-4fd3-b930-eabf095e96df",
    "role": "user"
  },
  "replyToId": "aacb51f0-22e8-11ea-9786-a543cb22378b",
  "serviceUrl": "https://7eec83e4.ngrok.io",
  "timestamp": "2019-12-20T05:22:13.958Z",
  "type": "trace",
  "value": "Operation returned an invalid status code 'Unauthorized'",
  "valueType": "https://www.botframework.com/schemas/error"
}

And that's all.

I've successfully acquired the token from the OAuth setting Test tool in azure portal and also using Postman, but i haven't been able to make these Demos work properly once OAuthCard should be presented for login. Debugging hasn't been helpful since there isn't other information apart from JSON exposed above.

Any guidance or orientation about how to fix this will be appreciated.


回答1:


There is no need to configure Azure Bot Service configurations in emulator. The Application Id and Application Password should be the same as those in appsettings.

And you should got these values from Azure portal under Configuration part.

Before doing this, please make sure the auth connection works.

Update:

You can change the Microsoft APPId here:



来源:https://stackoverflow.com/questions/59420484/azure-ad-integration-with-bot-framework-teams

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!