OneDrive for Business API item/file download conte

2019-01-29 06:26发布

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.

标签: onedrive
1条回答
ゆ 、 Hurt°
2楼-- · 2019-01-29 07:23

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

查看更多
登录 后发表回答