Microsoft Graph API下载文件内容返回未经授权的401 [英] Microsoft Graph API Download File content return Unauthorized 401

查看:64
本文介绍了Microsoft Graph API下载文件内容返回未经授权的401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用仅应用程序"令牌从SharePoint Online下载文件.我可以使用此网址获取文件信息

I'm trying to download a file from SharePoint Online using an "app only" token. I can obtain file info using this url

https://graph.microsoft.com:443/v1.0/sites/{siteId}/drives/{driveId}/list/items/{itemId}/driveItem

但是当我尝试使用此URL下载文件

But when I try to download the file with this url

https://graph.microsoft.com:443/v1.0/sites/{siteId}/drives/{driveId}/list/items/{itemId}/driveItem/content

我收到以下错误

403 FORBIDDEN

Content-Length →13
Content-Type →text/plain; charset=utf-8
Date →Fri, 13 Apr 2018 08:47:12 GMT
MicrosoftSharePointTeamServices →16.0.0.7604
P3P →CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
SPIisLatency →2
SPRequestDuration →53
X-Content-Type-Options →nosniff
X-MS-InvokeApp →1; RequireReadOnly
X-MSDAVEXT_Error →917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically.
X-MSEdge-Ref →Ref A: B9E0C567B0CC4E60AEE93EEB8DC06AF1 Ref B: VIEEDGE0813 Ref C: 2018-04-13T08:47:12Z
X-Powered-By →ASP.NET
X-SharePointHealthScore →0

怎么了?

似乎它在内部生成了一个下载链接(.../_ layouts/15/download.aspx?UniqueId = ...),该链接适用于用户名/pwd令牌,但不适用于仅应用"令牌

it seems that internally it generates a download link (.../_layouts/15/download.aspx?UniqueId=...) that works with username / pwd token, but does not work with "app only" token

我还有另一个Office 365订阅,该订阅可以使用仅应用程序"令牌.另一个订阅有一个自定义域,但是我看不到其他配置差异(都将LegacyAuthProtocolsEnabled属性设置为true,相同的共享选项...)

I have another office 365 subscription that works with "app only" token. The other subscription have a custom domain, but I can not see other configuration differences (both have LegacyAuthProtocolsEnabled property set to true, same sharing options...)

:似乎我在星期五测试的示例现在可以正常工作!

It seems that the example I was testing on friday now works!!

推荐答案

该错误于上周三出现,并传播给越来越多的租户.似乎由Graph API/Sharepoint API生成的临时令牌无效.这会影响:

This bug appeared wednesday last week, and is spreading to more and more of our tenants. It appears that temporary tokens generated by the Graph API/Sharepoint API are invalid. This affects:

  • 块状文件上传,因为您接收到一个带有临时令牌的URL
  • @ microsoft.graph.downloadUrl,因为它包含一个临时令牌
  • 内容下载,因为它使用与@ microsoft.graph.downloadUrl完全相同的URL

请尽快解决此问题,因为我的应用程序瘫痪并且客户很生气

Please fix this ASAP, as my application is cripled and the customers are angry

我也在这里创建了一个帖子,但没有回复:

I created a post here too, but no response: Temporary tokens issued by graph api is invalid since wednesday

此错误也在周三出现:

Also this bug appeared wednesday: Unable to set fileSystemInfo.lastModifiedDateTime on files on Sharepoint Online for some users since wednesday

您在此 Mark LeFleur 上找到了任何内容吗?

Did you find anything on this Mark LeFleur?

这篇关于Microsoft Graph API下载文件内容返回未经授权的401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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