Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
401 Unauthorized - WebDav - IOS #531
I've got Joplin up and running on my MacBook synchronizing to a QNAP NAS unit over WebDav. Same settings (URL/user/password) on my iPad gives a 401 Unauthorized error when I try to sync. Checking sync settings gives a "Success" message:
and if I change the username/password to be incorrect, I get the same error on the "Configuration" page
Here's the debug output. Any suggestions?
I just verified that this works to connect using Windows 10 off-network. Initially it told me it had succeeded when I had no notebooks and no notes. However once I added a notebook (fresh install of Joplin on my iPhone), it gave the 401 error when synchronizing.
I can't really get this end point working so I can't say if it's really an issue with the app.
Here are the kind of calls that the app would make, but none of them work even from the terminal:
Do you have any example of curl call that would actually work? Is the "joplintest" directory already created by the way (it needs to)?
I'm able to connect using those credentials using Windows 10 (Mapping a network location in Explorer) and MacOS through Finder (e.g., Go Menu -> Connect to Server) and the Transmit app. Each can open the directory and read/write to it.
I can also verify that even though you got a 405 Method Not Allowed, the MKCOL command worked. When I try to run MKCOL for a new directory (e.g., curl -X MKCOL -H "Authorization: Basic dGVzdHVzZXI6dGVzdDEyMzQ=" -H "If-None-Match: JoplinIgnore-81961" https://westfall.myqnapcloud.com/joplintest/.dsync ) I get a 201 Created response.
It seems like the problem comes not in creating directories, but in actually writing files. For example, curl -T -H "Authorization: Basic dGVzdHVzZXI6dGVzdDEyMzQ=" -H "If-None-Match: JoplinIgnore-81961" /Users/jon/test https://westfall.myqnapcloud.com/joplintest/test gives me the 401 Unauthorized error.
However I can take that same file and upload it to the WebDav folder through MacOS Finder.
Ok this is actually related to #523 - because there's no "/" at the end of the URL in the MKCOL call, the server redirects, but doing so the auth credentials are lost which results in the final 401 Unauthorized error. The loss of credentials is due to this never-fixed React Native bug.
I'm going to add the trailing "/" as @bradmcl suggested and see if the Nextcloud test units work. If they do, I'll make the change as it's probably more correct than not having the trailing "/".
I have similar problems with Ubuntu 18.04 desktop client version 1.0.104. The server runs Apache 2.0 and the URL is this, and it includes the trailing /:
However, when checking the syncronization configuration in joplin for the same URL I also get an error 401 unauthorized.
If I try with http instead of https, I get a 405 method not allowed error instead.
I can open the webdav repository without problems using both Chrome and Firefox from the same laptop where the joplin desktop app fails.
This is the server log using Firefox to access that resource:
220.127.116.11 - - [30/Jul/2018:15:06:15 +0000] "GET /webdav/joplin/ HTTP/1.1" 401 6799 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0"
18.104.22.168 - fmmarzoa_joplin [30/Jul/2018:15:06:23 +0000] "GET /webdav/joplin/ HTTP/1.1" 200 1018 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0"
22.214.171.124 - - [30/Jul/2018:15:06:24 +0000] "GET /favicon.ico HTTP/1.1" 200 7717 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0"
Between line 1 and 2, Firefox ask for my credentials, then the access is granted.
This is the server log using Joplin desktop client:
126.96.36.199 - - [30/Jul/2018:15:09:28 +0000] "PROPFIND /webdav/joplin// HTTP/1.1" 401 2390 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
Just noticed that both Firefox and Chrome use GET instead of PROPFIND, I'm going to research this more. Anyway, it seems like Joplin does not try to authenticate after that error, unlike the aforementioned browsers.
BTW, I have tried also https://marzoa.com/webdav/joplin without the last / with the same results.
Just saw that the AuthType in the apache server is set to Digest. Could this be a problem for joplin?
Try this, it worked for me!