如何在 Azure 中向 Microsoft Teams Bot 添加授权

How to add authorization to Microsoft Teams Bot in Azure

我在 Azure 中托管了一个按预期工作的机器人,但我想通过 Azure Active Directory 添加授权。 我已经将 oauth2AllowIdTokenImplicitFlow 和 oauth2AllowImplicitFlow 设置为 true 并在授权下检查了 ID-Token。

但是当我访问我的托管机器人时 Url 我仍然收到这条消息:

AADSTS700054: response_type 'id_token' 没有为应用程序启用。

是否有更好的授权方式,还是我遗漏了什么?

提前致谢!

我不是很清楚你的意思 "connected to SharePoint.." - 你的意思是 Bot 调用这些产品,比如使用应用凭证,这就是你想要对用户进行身份验证的原因?如果是这样,您应该查看 Authentication flow for Bots 作为 Teams 文档的一部分。

本质上,它涉及发送一种特殊的 "card" 响应(如果您没有发送卡片,这意味着您发送的不是短信给用户,而是一种"mini form" 在聊天 window 中)。卡片上还有更多内容 here, but specifically later on in the doc is a part about the card you need, the signin card

第一篇文章 link 到第二篇文章,其中包含有关启动和 运行、获取访问令牌以及 link 到示例项目。参见 Add authentication to your Teams bot

希望对您有所帮助。