简体   繁体   English

如何使用登录用户在Bot Framework中对SharePoint进行身份验证?

[英]How do I authenticate to SharePoint in Bot Framework using logged in user?

I'm working on a bot running on MS Teams. 我正在研究在MS Teams上运行的机器人。

I'm trying to get logged in user information and use it to authenticate to SharePoint API, but without luck so far. 我正在尝试登录用户信息,并使用它来对SharePoint API进行身份验证,但到目前为止还算不上成功。

I'm using the controller from the following example: https://github.com/stephaneey/transparent-auth-bot/blob/master/transparent-auth-bot/Controllers/MessagesController.cs#L64 我正在使用以下示例中的控制器: https : //github.com/stephaneey/transparent-auth-bot/blob/master/transparent-auth-bot/Controllers/MessagesController.cs#L64

But I'm unable to get the token (line 64), it remains null/ 但是我无法获得令牌(第64行),它仍然为null /

The sample you are providing is demonstating the ability to get a Graph API token and reuse it in a Bot. 您提供的示例正在演示获取Graph API令牌并在Bot中重用它的能力。

As you can see here , this token is generated during a specific authentication process: there is a website displaying a webchat, and when you want to access it you have to login. 正如您在此处看到的那样,此令牌是在特定的身份验证过程中生成的:存在一个显示网聊的网站,当您要访问它时,必须登录。 That's where the value of the "GraphAccessToken" is generated and stored in a BotData object, which can be accessed from the code of the bot. 在那里,将生成"GraphAccessToken"的值并将其存储在BotData对象中,该对象可以从漫游器的代码进行访问。

Here if you use MS Teams you never asked the user to login, so there is no magic: the value will be null. 在这里,如果您使用MS Teams,则从未要求用户登录,因此没有任何魔力:该值将为null。

In a few words, if your target channel is Teams, you will not be able to automatically get an user token which you can use to query SharePoint API: you have to go through a manual login process. 简而言之,如果您的目标渠道是Teams,则将无法自动获取可用于查询SharePoint API的用户令牌:您必须执行手动登录过程。

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

相关问题 如何验证SharePoint用户凭据 - How can I authenticate SharePoint user credentials 如何在ASP.NET Identity框架中对用户进行身份验证? - How do I authenticate user in ASP.NET Identity framework? Microsoft Bot Framework,如何验证用户登录 Web 应用程序 - Microsoft Bot Framework, How to authenticate user to login in web app 如何通过 Bot Framework 向 Teams 中的用户发送通知? - How do I send a notification to a user in Teams via the Bot Framework? 使用 Bot Framework v4,我如何确定 OAuthPrompt 是刚刚登录还是令牌已经存在? - Using Bot Framework v4, how can I determine if an OAuthPrompt was just logged in or if the token already existed? 如何在Sharepoint中找到登录用户? - How to find the logged in user in Sharepoint? 如何使用Bot Framework将create Menu添加到我的Facebook Bot - How do I add create Menu to my Facebook Bot using the Bot Framework 我如何知道您已登录Sharepoint网页? - How do I know you have logged in a Sharepoint WebPage? 使用 C# 从 Bot 框架中的 MS Teams 获取登录用户 Email id - Get logged-In user Email id from MS Teams in Bot framework using C# 如何为需要用户进行身份验证的Bot Framework v4对话框编写单元测试? - How to write unit tests for a Bot Framework v4 Dialog that requires the user to authenticate?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM