简体   繁体   English

Microsoft Bot Framework.Net 中的 Directline API 和 OAuth2 有什么区别?

[英]What's the difference between the Directline API and OAuth2 in Microsoft Bot Framework .Net?

I'm thinking of how to implement Authentication in my Bot Project.我正在考虑如何在我的 Bot 项目中实现身份验证。 My Boss wants Directline API from Azure as our go-to but there is no useful documentation provided by the Microsoft team.我的老板想要 Azure 的 Directline API 作为我们的首选,但微软团队没有提供有用的文档。 Another authentication is OAuth2 from Azure.另一种身份验证是来自 Azure 的 OAuth2。 Are these two similar?这两个相似吗? I know they both provide an Authentication token.我知道他们都提供了一个身份验证令牌。 But I would like to hear any suggestions from you guys.但我想听听你们的任何建议。

I need to embed my Bot to the React Web-App.我需要将我的 Bot 嵌入到 React Web-App。 My plan is to only use the Bot if the user is logged-in within the App.我的计划是仅当用户在应用程序中登录时才使用机器人。 So if it does whenever the user type/send message to the Bot.因此,只要用户键入/向 Bot 发送消息,它就会这样做。 I need to authenticate that request and so on.我需要验证那个请求等等。

The Direct Line service (along with other channel connectors) in the bot framework utilizes Oauth .机器人框架中的 Direct Line 服务(以及其他通道连接器) 使用 Oauth The connector service lives (and handles communication) between the chat client and the bot (your code).连接器服务在聊天客户端和机器人(您的代码)之间存在(并处理通信)。 This is related to authenticating and handling communication between these endpoints.这与验证和处理这些端点之间的通信有关。 The bot resource ( bot channels registration or web app bot ) actually is dependent on an Azure AAD application that gets created along with that resource (uses client secret, etc).机器人资源( bot channels registrationweb app bot )实际上依赖于与该资源一起创建的 Azure AAD 应用程序(使用客户端密码等)。

Additionally, user authentication can be done, and there are bot framework SDK samples on how to implement that (let me know if you need examples).此外,可以进行用户身份验证,并且有 bot 框架 SDK 示例说明如何实现该示例(如果您需要示例,请告诉我)。

Samples:样品:

  • Here is the main samples repo with readme.是带有自述文件的主要示例 repo。
  • Here are the .NET (core) specific ones. 是 .NET(核心)特定的。
  • Here is a sample that shows user authentication using OAuth. 以下示例显示了使用 OAuth 进行用户身份验证。 Remember this is different than client (Teams or Slack application for example) or channel authentication.请记住,这与客户端(例如 Teams 或 Slack 应用程序)或通道身份验证不同。 This is regarding authenticating a user to the bot through OAuth.这是关于通过 OAuth 对机器人进行用户身份验证。 The readme contains this link already, but make sure you read and follow this article on how to add authentication.自述文件已经包含此链接,但请确保您阅读并遵循这篇关于如何添加身份验证的文章。
  • Here is a sample using OAuth but also has calls utilizing that, to make calls to MSGraph. 是一个使用 OAuth 的示例,但也有使用它的调用来调用 MSGraph。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM