问题描述
我的问题似乎与 OneDrive for Business REST API- PUT,POST-401未经授权
但是,我没有下载,而是尝试下载文件.奇怪的是,我确实获得了文件的内容和数据,但是响应代码是401.
However, instead of uploading, I am trying to download a file. What's strange is that I do get the file contents and data, but the response code is a 401.
知道为什么吗?当然,我希望收到200,而不必忽略响应代码.
Any idea why? Of course, I would like to be receiving a 200 and not have to ignore the response code.
就我的Azure AD应用程序权限而言,我允许Office 365的委派权限下的几乎所有读取权限.我列出了我在此处选择的所有权限,供您参考.
As far as my Azure AD app permissions go, I am allowing pretty much all read permissions under delegated permissions for Office 365. I have listed all the permissions I selected here, for your reference.
我允许使用Office 365的委派权限:读取托管元数据以用户身份运行搜索查询阅读所有网站集中的项目读取用户文件
Delegated Permissions I am allowing for Office 365:Read managed metadataRun search queries as a userRead items in all site collectionsRead user files
我允许使用Windows Azure Active Directory的委派权限:启用登录并读取用户的个人资料
Delegated Permissions I am allowing for Windows Azure Active Directory:Enable sign-on and read users' profiles
我尚未在应用程序权限"下启用任何功能.
I have not enabled anything under Application Permissions.
推荐答案
我们的实现中存在一个错误-如果您在下载URL上提供了带有承载令牌的Authorization:标头(预先认证),则该服务将被拒绝身份验证(因此为401),但是由于URL已预先身份验证,因此文件的内容仍会发送.
There is a bug in our implementation - if you provide an Authorization: header with a bearer token on the download URL (which is pre-authenticate) the service rejects the authentication (hence the 401) but since the URL is pre-authenticated, the contents of the file are still sent.
我们正在努力解决.您可以通过在我们的GitHub存储库上观看此问题来跟踪状态: https://github .com/OneDrive/onedrive-api-docs/issues/189
We're working on a fix. You can track the status by watching this issue on our GitHub repo: https://github.com/OneDrive/onedrive-api-docs/issues/189
这篇关于OneDrive for Business API项/文件下载内容401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!