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

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

问题描述

我正在尝试使用仅限应用"令牌从 SharePoint Online 下载文件.我可以使用这个 url 获取文件信息

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=...),该链接适用于用户名/密码令牌,但不适用于仅限应用"令牌

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:

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

请尽快解决这个问题,因为我的应用程序已瘫痪,客户很生气

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

我也在这里创建了一个帖子,但没有回复:临时代币由图 api 自周三起无效

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

周三也出现了这个错误:自星期三以来,无法为某些用户在 Sharepoint Online 上的文件设置 fileSystemInfo.lastModifiedDateTime

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天全站免登陆