401使用SharePoint CSOM ClientContext和OAuth的未经授权的错误 [英] 401 Unauthorized error using SharePoint CSOM ClientContext and OAuth

查看:180
本文介绍了401使用SharePoint CSOM ClientContext和OAuth的未经授权的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从winforms应用程序向SharePoint Online(通过ClientContext)进行CSOM调用时遇到问题。我的环境具有与Office 365通信的Active Directory联合身份验证服务服务器。 

I have been having problems attempting to make CSOM calls to SharePoint Online (via ClientContext) from a winforms application. My environment has an Active Directory Federation Services Server in communication with Office 365. 

我正在使用ClientId,Client Secret和TenantId创建ClientContext;换言之,高信任情景。我一直在使用Fiddler观察消息流量。

I am creating a ClientContext using the an ClientId, Client Secret and TenantId ; in other words a high trust scenario. I've been using Fiddler to watch message traffic.

创建上下文时,我按预期收到了一个Bearer令牌。但是每当我使用上下文进行呼叫时,我都会收到401个未经授权的响应以及一些额外的错误消息:

When creating the context I receive a Bearer token as expected. However whenever I make a call using the context I keep getting 401 Unauthorized responses with some additional error messaging :

x-ms-diagnostics:3000006; reason =" Token contains无效签名";类别"invalid_client"

x-ms-diagnostics: 3000006;reason="Token contains invalid signature"; category"invalid_client"

响应正文显示"不支持的安全令牌"。

the body of the response says "Unsupported security token".

事情就是这一切都正常几个星期前,在新的一年之前,它突然停止工作,我一直无法找出原因。

The thing of it is this was all working fine several weeks ago, before the new year, and all of a sudden it stopped working and I've been unable to figure out why.

谢谢

推荐答案

 

尝试检查加载项密钥是否已过期。

 


applist = Get-MsolServicePrincipal -all | Where-Object -FilterScript {(
applist = Get-MsolServicePrincipal -all |Where-Object -FilterScript { (


_。DisplayName-notlike" * Microsoft *") - 和(
_.DisplayName -notlike "*Microsoft*") -and (


这篇关于401使用SharePoint CSOM ClientContext和OAuth的未经授权的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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