[Bug?] Zotero does not send password to some WebDAV servers
Error report 1839218295
When I try to set up WebDAV sync I see the error: [JavaScript Error: "The WebDAV server did not accept the username and password you entered. Please check your file sync settings or contact your WebDAV server administrator."]
On my web server, this request has been logged without an authorization header:
PROPFIND /remote.php/dav/spaces/03802235-e3a0-4e0c-8ffb-d0d480d29665$467d8181-ab7c-4e00-ad8e-33e8495fdf2f/Mechanisms/!Program%20Data/zotero/ HTTP/1.0
Host: ******
Connection: close
Content-Length: 66
user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
accept: */*
accept-language: en-US,en;q=0.5
accept-encoding: gzip, deflate, br
content-type: text/xml; charset=utf-8
depth: 0
Meanwhile, another client (Rclone) is able to authenticate with my WebDAV server:
PROPFIND /remote.php/dav/spaces/03802235-e3a0-4e0c-8ffb-d0d480d29665$467d8181-ab7c-4e00-ad8e-33e8495fdf2f/Mechanisms/%21Program%20Data/nonexistent/ HTTP/1.0
Host: ******
Connection: close
Content-Length: 308
user-agent: rclone/1.68.2
authorization: Basic ****
depth: 1
accept-encoding: gzip
I can give you test credentials on this server, although this bug appears to be Zotero deciding to not send the credentials in the place.
When I try to set up WebDAV sync I see the error: [JavaScript Error: "The WebDAV server did not accept the username and password you entered. Please check your file sync settings or contact your WebDAV server administrator."]
On my web server, this request has been logged without an authorization header:
PROPFIND /remote.php/dav/spaces/03802235-e3a0-4e0c-8ffb-d0d480d29665$467d8181-ab7c-4e00-ad8e-33e8495fdf2f/Mechanisms/!Program%20Data/zotero/ HTTP/1.0
Host: ******
Connection: close
Content-Length: 66
user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
accept: */*
accept-language: en-US,en;q=0.5
accept-encoding: gzip, deflate, br
content-type: text/xml; charset=utf-8
depth: 0
Meanwhile, another client (Rclone) is able to authenticate with my WebDAV server:
PROPFIND /remote.php/dav/spaces/03802235-e3a0-4e0c-8ffb-d0d480d29665$467d8181-ab7c-4e00-ad8e-33e8495fdf2f/Mechanisms/%21Program%20Data/nonexistent/ HTTP/1.0
Host: ******
Connection: close
Content-Length: 308
user-agent: rclone/1.68.2
authorization: Basic ****
depth: 1
accept-encoding: gzip
I can give you test credentials on this server, although this bug appears to be Zotero deciding to not send the credentials in the place.
Yes, my server behaves as required: 401 and WWW-Authenticate.
Your server isn't behaving like most WebDAV servers. We make an OPTIONS request to determine if a URL is a WebDAV path, and generally WebDAV servers put those behind authentication, because not all paths are WebDAV paths and they don't want to reveal what's a valid path to an unauthenticated user. But your server is returning 204 for any URL, existing or not.
But a 401 with WWW-Authenticate in response to a PROPFIND should also trigger authentication, so we'd want to look into why that's not happening.
www-authenticate: Bearer realm="[domain]", charset="UTF-8"
, which is for OAuth clients. It needs to advertise itself as supporting Basic or Digest auth.But is it necessary for Zotero to perform a two-step "smart" initialization for WebDAV? By two-step, I mean first attempting to connect without any credential, then only if authentication is required, send the credentials using the type detected in the first step.
Most clients ask the user to specify the credentials with its type (basic/digest/OAuth/etc). The client would only perform one request with the credentials. This seems least error-prone.
Clients which support interactive setup usually do not ask for credentials until they see www-authenticate from the server.
In any case, this is unlikely to change on our end, so you should fix your server to issue a proper WWW-Authenticate for Basic Auth.
It is understandable for Zotero to only support Basic and Digest. However, it is also a fact that more and more providers, including my own selfhosted services, are OAuth-native. This will become a real issue in the foreseeable future. Users then might find it absurd to enter a user name and password in an (untrustworthy) third-party client; instead, they might expect a web login and authorization flow.