获取访问令牌 [英] Get Access Token

查看:62
本文介绍了获取访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个非常大的OnPrem SharePoint安装。我们有一个Tibco ESB,需要将文档上传到SharePoint存储库,作为我们整体合同管理工作流程的一部分。 Tibco正在尝试通过OAuth进行连接,但我发现的所有文档
只有如何为Office 365和Azuure生成OAuth访问令牌。我把一个使用TokenHelper.cs类的小型控制台应用程序放在一起但似乎是硬编码到目标Azure。我当然可以更新TokenHelper以定位
a不同的端点,但是我找不到为端点安装提供的端点上的任何文档来生成访问令牌。


这是我放置的控制台在一起


static void Main(string [] args)

        {

            String siteUrl =" http:// xxxxx"; $


            //获取网址领域

            string realm = TokenHelper.GetRealmFromTargetUrl(new Uri(siteUrl));
$


            //获取网址的访问令牌。  

            string accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal,new Uri(siteUrl).Authority,realm).AccessToken;



            //根据检索到的访问令牌创建客户端上下文对象

            //现在保存访问令牌

            var accessFile =  File.CreateText(@"C:\ src \accessToken.txt");

            accessFile.WriteLine(accessToken);

            accessFile.Flush();

            accessFile.Close();

        }


我只想弄清楚如何获取Tibco的访问令牌,我不是在寻求帮助来获得连接到SharePoint的控制台。我可以通过CSOM或去真正的旧学校并使用服务器对象模型,但这些都不是带有Tibco的选项
。非常感谢帮助

解决方案

您好


我对此不太熟悉,下面链接供你参考。我担心你必须使用Azure。


https://newsignature.com/articles/setting-up-oauth-for-sharepoint-2013-using-authentication-servers-acs/


We have a very large OnPrem SharePoint installation. We have a Tibco ESB that needs to upload documents to a SharePoint repository as part of our overall contract management workflow. Tibco is attempting to connect via OAuth but all of the documentation I can find only has how to generated the OAuth access token for Office 365 and Azuure. I threw together a little console application that uses the TokenHelper.cs class but that seems to be hardcoded to target Azure. I can certainly update TokenHelper to target a different endpoint but I cannot find any documentation on the endpoint provided for SharePoint on prem installations to generate access tokens.

Here's the Console that I put together

static void Main(string[] args)
        {
            String siteUrl = "http://xxxxx";

            //Get the realm for the URL
            string realm = TokenHelper.GetRealmFromTargetUrl(new Uri(siteUrl));

            //Get the access token for the URL.  
            string accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, new Uri(siteUrl).Authority, realm).AccessToken;

            //Create a client context object based on the retrieved access token
            //Now save the access token
            var accessFile =  File.CreateText(@"C:\src\accessToken.txt");
            accessFile.WriteLine(accessToken);
            accessFile.Flush();
            accessFile.Close();
        }

I'm just trying to figure out how to get an access token for Tibco, I'm not asking for assistance getting a console to connect to SharePoint. I can to that with CSOM or go really old school and use the server object model but neither of those is an option with Tibco. Help is greatly appreciated

解决方案

Hi

I am not very familiar with this, below link for your reference. I am afraid you have to use Azure.

https://newsignature.com/articles/setting-up-oauth-for-sharepoint-2013-using-authentication-servers-acs/


这篇关于获取访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆