studio-b12 / gowebdav

A golang WebDAV client library and command line tool.
BSD 3-Clause "New" or "Revised" License
309 stars 89 forks source link

[BUG/FEATURE] OneDrive Support #68

Closed Gamer92000 closed 1 year ago

Gamer92000 commented 1 year ago

Hello Collaborators,

Describe the bug When using OneDrive as the WebDav server things get weird. In short: The authentication fails because of Microsoft.

Software

To Reproduce

  1. Create a client using OneDrive credentials
  2. Try to use any (authenticated) request (e.g. ReadDir())
  3. Response is empty / unexpected (e.g. no files)

Expected At least an authentication error should be returned. Even better would be support for MS's need to be proprietary.

Additional context Microsoft (as expected) does not follow industry standards and instead of returning 401 on unauthenticated requests they return 302 to redirect you to the login page. The login page then return a 200 status so the webdav client thinks it is a valid result for the original request. On its own this would not be too bad as you could catch the redirect and handle it like a 401. But since Microsoft use their own authentication method (MS-PASS with Passport1.4) you also need a new authenticator.

bai-jie commented 1 year ago

Related information:

One of the current workarounds:

Gamer92000 commented 1 year ago

Thanks for all the references @bai-jie! Unfortunately, this does not work for OneDrive but only SharePoint. But it still helped a lot with getting me started. In the end, I mostly followed MS's example for Passport1.4 though.