提供商托管的应用程序:TokenHelper无权获取上下文 [英] Provider hosted app: TokenHelper not authorized to get context

查看:122
本文介绍了提供商托管的应用程序:TokenHelper无权获取上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我遵循"打包并发布高可信度SharePoint加载项"将Provider Hosted App部署到生产环境的文章。它安装了正确的SSL证书,它在SharePoint中注册并且TokenHelper类被修改。对于网站和网站集,App
权限设置为完全控制。



当我使用  TokenHelper.CreateAppEventClientContext(properties,
false)
 或  TokenHelper.CreateRemoteEventReceiverClientContext(properties) 方法
获取  ClientContext ,它返回null,代码抛出401 Unauthorized exception。



当我手动创建并提供农场管理员帐户的凭据时,我得到了一个正确的ClientContext,但它不是一个可接受的生产解决方案。另外,从这两种方法来看,正确的方法是什么在这种情况下获取ClientContext?

解决方案

您好


请参阅以下链接。


https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/troubleshooting-high-trust-sharepoint-add-ins


I followed the "Package and publish high-trust SharePoint Add-ins" article to deploy Provider Hosted App to production environment. It has a proper SSL certificate installed, it's registered within SharePoint and TokenHelper class is modified. App permissions are set to Full Control for web and site collection.

When I use TokenHelper.CreateAppEventClientContext(properties, false) or TokenHelper.CreateRemoteEventReceiverClientContext(properties) methods to get ClientContext, it's returned null and the code throws 401 Unauthorized exception.

I get a proper ClientContext when I create it manually and provide the credentials of farm admin account, but it's not an acceptable solution for production. Also, from the two methods, what is the correct way to get ClientContext in this case?

解决方案

Hi

Please refer below link.

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/troubleshooting-high-trust-sharepoint-add-ins


这篇关于提供商托管的应用程序:TokenHelper无权获取上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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