Webdav client propfind

I am trying to write a webdav javascript client, but am running into problems right out of the gate.

First I want to get the files in the / directory (main directory).

PROPFIND 401 unauthorized

From Chrome developer tools/network/headers


Request URL: https://username:password@exampleplex.com:8008/nextcloud/remote.php/dav/files/username/
Request Method: PROPFIND
Status Code: 401 Unauthorized
Remote Address:
Referrer Policy: no-referrer-when-downgrade

Request Headers:

Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Content-Type: text/xml; charset=UTF-8
Cookie: nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=username; oc_sessionPassphrase=JJAxfI9b%2BdR7gk%2BYOf5un70pxfCCmrqutABsP4BduHBsllzVWbVs2zdHq8QbJi0FosUOSI60uOuHE6YP3%2BuW%2BMWEP%2BUDZz15E8y5SLJJwMrN9gwTMXS2%2F0GLcEOKIEM3; ociz8rn99eow=5k1m6vhji98k9hkmv97lpaa2u0; nc_token=gjESKhyag%2Bu5kOEcNE1dtoEbfLc6XTMv; nc_session_id=5k1m6vhji98k9hkmv97lpaa2u0
Depth: 1
DNT: 1
Host: exampleplex.com:8008
Origin: https://exampleplex.com:8008
Pragma: no-cache
Referer: https://exampleplex.com:8008/webdavtest/index.html
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Note: I masked out my real username and password and url.

Is this the proper way to do a PROPFIND on the top directory?


If it helps, here is webdav-fs. It is built with node.js

I need it to work in a browser, it will be an extension. So Node is out. I am basing this on another github library. I am thinking there is something Nextcloud-ish I am doing wrong because the library I am using I am extending to have a username and password with it.