npm-WebDAV-Server icon indicating copy to clipboard operation
npm-WebDAV-Server copied to clipboard

MS Office apps want credentials when no authentication is set up

Open Papooch opened this issue 5 years ago • 1 comments

Hello, I have managed to implement a simple webdav server, but I'm struggling with MS Office documents.

When I have authentication disabled, all files open normally, but MS Word (having a WebDAV client built in) asks for credentials before even asking for the file. When I have basic authentication enabled, I am asked to fill in credentials to connect, and when I do, all files open normally, but MS Word does not even ask for credentials, but never asks for the file aslo.

When I enable digest authentication, it does not work at all (the credentials are not accepted).

Has anyone else encountered this behavior? I am pretty much stuck at this point. Thanks in advance for any pointers.

I am using express and would like to handle the authentication through that, so a solution with no authentication is preferred.

Minimal reproducible example:

const webdav = require('webdav-server').v2;

const server = new webdav.WebDAVServer({
    hostname: "localhost",
    port: 8000
});

server.rootFileSystem().addSubTree(server.createExternalContext(), {
    'i_can_open_this_ok.txt': webdav.ResourceType.File,
    'this_asks_for_credentials.docx': webdav.ResourceType.File       // /file0.txt
})

server.start(httpServer => {
    console.log('Server started');
});

then go to http://127.0.0.1:8000 in file explorer.

Papooch avatar Nov 03 '20 16:11 Papooch

For anyone wondering, my problem was that MS Word was sending this header:

authentication: Bearer

which was triggering a "Not authorized" response (no idea why).

I "Fixed" this by capturing the request before it was sent to webdav and and removing this header. This seems to have fixed the issue and now the document can be opened and edited.

Papooch avatar Nov 04 '20 11:11 Papooch