OneDrive for Business API item/file download content 401

左心房为你撑大大i 提交于 2019-11-28 12:02:50

问题


My question seems similar to OneDrive for Business REST API - PUT,POST - 401 Unauthorized

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.

Any idea why? Of course, I would like to be receiving a 200 and not have to ignore the response code.

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.

Delegated Permissions I am allowing for Office 365: Read managed metadata Run search queries as a user Read items in all site collections Read user files

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.


回答1:


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.

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



来源:https://stackoverflow.com/questions/32144097/onedrive-for-business-api-item-file-download-content-401

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!