[nextcloud] can't connect because webview (saml)

Hi, my ISP started offer a nextcloud[0] instance for its customers.
Problem is, even using rclone-latest[1] I can’t connect

config
 ./rclone config
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> fw
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / A stackable unification remote, which can appear to merge the contents of several remotes
   \ "union"
 2 / Alias for a existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Dropbox
   \ "dropbox"
 9 / Encrypt/Decrypt a remote
   \ "crypt"
10 / FTP Connection
   \ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
12 / Google Drive
   \ "drive"
13 / Hubic
   \ "hubic"
14 / JottaCloud
   \ "jottacloud"
15 / Local Disk
   \ "local"
16 / Mega
   \ "mega"
17 / Microsoft Azure Blob Storage
   \ "azureblob"
18 / Microsoft OneDrive
   \ "onedrive"
19 / OpenDrive
   \ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
21 / Pcloud
   \ "pcloud"
22 / QingCloud Object Storage
   \ "qingstor"
23 / SSH/SFTP Connection
   \ "sftp"
24 / Webdav
   \ "webdav"
25 / Yandex Disk
   \ "yandex"
26 / http Connection
   \ "http"
Storage> webdav
** See help for webdav backend at: https://rclone.org/webdav/ **

URL of http host to connect to
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Connect to example.com
   \ "https://example.com"
url> https://cloud.wowspace.it
Name of the Webdav site/service/software you are using
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / Nextcloud
   \ "nextcloud"
 2 / Owncloud
   \ "owncloud"
 3 / Sharepoint
   \ "sharepoint"
 4 / Other site/service or software
   \ "other"
vendor> nextcloud
User name
Enter a string value. Press Enter for the default ("").
user> REDACTED
Password.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank
y/g/n> y
Enter the password:
password:
Confirm the password:
password:
Bearer token instead of user/pass (eg a Macaroon)
Enter a string value. Press Enter for the default ("").
bearer_token> 
Remote config
--------------------
[fw]
type = webdav
url = https://cloud.wowspace.it
vendor = nextcloud
user = REDACTED
pass = *** ENCRYPTED ***
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
fw                   webdav

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
 ./rclone -vv lsd fw:
2018/12/04 20:24:31 DEBUG : rclone: Version "v1.45-021-g26b5f55c-beta" starting with parameters ["./rclone" "-vv" "lsd" "fw:"]
2018/12/04 20:24:31 DEBUG : Using config file from "/home/USER/.config/rclone/rclone.conf"
2018/12/04 20:24:31 ERROR : : error listing: couldn't list files: 405 Method Not Allowed
2018/12/04 20:24:31 Failed to lsd: couldn't list files: 405 Method Not Allowed

Official nextcloud app[2] works fine, when asked for the server it open a webview[3] where I insert username and password.

Can you help me?
thanks

[0] version should be 13.0.7.2

[1] ./rclone version
rclone v1.45-021-g26b5f55c-beta

  • os/arch: linux/amd64
  • go version: go1.11.2

[2] https://play.google.com/store/apps/details?id=com.nextcloud.client

[3] https://docs.nextcloud.com/server/13/developer_manual/client_apis/LoginFlow/index.html

When you logged in via the nextcloud app did it show you the user-agent?

If so you could try giving that to rclone and see if it works with this flag

  --user-agent string   Set the user-agent to a specified string. The default is rclone/ version (default "rclone/v1.45")

Can you read the username/password that the nextcloud app is using?

If you can somehow get the credentials from the nextcloud app I’m pretty sure rclone will work with them.

did not show it.

nextcloud on android used webview and on my device is provided by Firefox Focus. According to this
https://github.com/mozilla-mobile/focus-android/commit/aa0e8058c5c70e3395b2e2d3411b6b1ab0a17ea7

but did not work either

2018/12/04 23:49:45 DEBUG : rclone: Version "v1.45-021-g26b5f55c-beta" starting with parameters ["./rclone" "-vv" "--user-agent" "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36" "ls" "fw:"]
2018/12/04 23:49:45 DEBUG : Using config file from "/home/USER/.config/rclone/rclone.conf"
2018/12/04 23:49:46 ERROR : : error listing: couldn't list files: 405 Method Not Allowed
2018/12/04 23:49:46 Failed to ls: couldn't list files: 405 Method Not Allowed

I checked the nextcloud dir in /data/data/com.nextcloud.client/

/data/data/com.nextcloud.client/shared_prefs/com.nextcloud/client_preferences.xml
has an entry called pushToken
I tested the long string with --webdav-bearer-toke without success (same error as above)

There is also this two files that have nc, maybe related to [3]

/data/data/com.nextcloud.client/files/nextcloud/nc-keypair/
push_key.pub
push_ley.priv

Can you try doing the login in a normal desktop browser? And see if you can get the nc://login/server:<server>&user:<username>&password:<password> string that way?

The nextcloud web interface normally shows a URL for use with a webdav client if I remember correctly.

I have the har (HTTP Archive format). Can I share it with you?

edit.
I got the log from nextcloud client android

nextcloud log
2018/12/05 00:39:02
Model : Nexus 5

2018/12/05 00:39:02
Brand : google

2018/12/05 00:39:02
Product : hammerhead

2018/12/05 00:39:02
Device : hammerhead

2018/12/05 00:39:02
Version-Codename : REL

2018/12/05 00:39:02
Version-Release : 7.1.2

2018/12/05 00:39:02
Debug : start logging

2018/12/05 00:39:02
ThumbnailsCacheManager : create dir: /storage/emulated/0/Android/data/com.nextcloud.client/cache/thumbnailCache

2018/12/05 00:39:03
NetworkUtils : Searching known-servers store at /data/user/0/com.nextcloud.client/files/knownServers.bks

2018/12/05 00:39:03
OwnCloudClient #0 : Creating OwnCloudClient

2018/12/05 00:39:03
FileDisplayActivity : onCreate() start

2018/12/05 00:39:03
FileDisplayActivity : onCreate(Bundle) starting

2018/12/05 00:39:03
FileDisplayActivity : onStart() starting

2018/12/05 00:39:03
OwnCloudClient #1 : Creating OwnCloudClient

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
OwnCloudClient #2 : Creating OwnCloudClient

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
FileDisplayActivity : Initializing Fragments in onAccountChanged..

2018/12/05 00:39:03
FileDisplayActivity : Access to unexisting list of files fragment!!

2018/12/05 00:39:03
FileDisplayActivity : Still have a chance to lose the initializacion of list fragment >(

2018/12/05 00:39:03
ExternalLinks : links disabled

2018/12/05 00:39:03
OwnCloudClient #3 : Creating OwnCloudClient

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
OwnCloudClient #4 : Creating OwnCloudClient

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
FileDisplayActivity : Access to unexisting list of files fragment!!

2018/12/05 00:39:03
FileDisplayActivity : onResume() start

2018/12/05 00:39:03
FileDisplayActivity : onResume() starting

2018/12/05 00:39:03
OCFileListFragment : onAttach

2018/12/05 00:39:03
OCFileListFragment : onCreateView() start

2018/12/05 00:39:03
ExtendedListFragment : onCreateView

2018/12/05 00:39:03
OCFileListFragment : onCreateView() end

2018/12/05 00:39:03
OCFileListFragment : onActivityCreated() start

2018/12/05 00:39:03
FileDisplayActivity : onResume() end

2018/12/05 00:39:03
OperationsService : Creating service

2018/12/05 00:39:03
OwnCloudClient #5 : Creating OwnCloudClient

2018/12/05 00:39:03
FileDownloader : Creating service

2018/12/05 00:39:03
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:03
FileUploader : Creating service

2018/12/05 00:39:04
OwnCloudClient #5 : REQUEST GET /index.php/204

2018/12/05 00:39:04
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:04
UploadsStorageManager : Updating state of any killed upload

2018/12/05 00:39:04
UploadsStorageManager : No upload was killed

2018/12/05 00:39:04
AdvancedSslSocketFactory : Creating SSL Socket with remote cloud.wowspace.it:443, local null:0, params: org.apache.commons.httpclient.params.HttpConnectionParams@7cbe791

2018/12/05 00:39:04
AdvancedSslSocketFactory :  ... with connection timeout 60000 and socket timeout 60000

2018/12/05 00:39:04
Avatar : URI: https://cloud.wowspace.it/index.php/avatar/USERNAME/384

2018/12/05 00:39:04
ServerNameIndicator : SSLSocket implementation: com.google.android.gms.org.conscrypt.Java8FileDescriptorSocket

2018/12/05 00:39:04
ServerNameIndicator : SNI done, hostname: cloud.wowspace.it

2018/12/05 00:39:04
OwnCloudClient #1 : REQUEST GET /index.php/avatar/USERNAME/384

2018/12/05 00:39:04
AdvancedSslSocketFactory : Creating SSL Socket with remote cloud.wowspace.it:443, local null:0, params: org.apache.commons.httpclient.params.HttpConnectionParams@69fe4df

2018/12/05 00:39:04
AdvancedSslSocketFactory :  ... with connection timeout 60000 and socket timeout 60000

2018/12/05 00:39:04
ServerNameIndicator : SNI done, hostname: cloud.wowspace.it

2018/12/05 00:39:04
OwnCloudClient #2 : REQUEST GET /ocs/v1.php/cloud/users/USERNAME

2018/12/05 00:39:04
AdvancedSslSocketFactory : Creating SSL Socket with remote cloud.wowspace.it:443, local null:0, params: org.apache.commons.httpclient.params.HttpConnectionParams@e3d1bf5

2018/12/05 00:39:04
AdvancedSslSocketFactory :  ... with connection timeout 60000 and socket timeout 60000

2018/12/05 00:39:04
ServerNameIndicator : SNI done, hostname: cloud.wowspace.it

2018/12/05 00:39:04
OwnCloudClient #0 : REQUEST GET /index.php/204

2018/12/05 00:39:04
OwnCloudClient #4 : REQUEST GET /ocs/v1.php/cloud/users/USERNAME

2018/12/05 00:39:04
OwnCloudClient #6 : Creating OwnCloudClient

2018/12/05 00:39:04
AdvancedSslSocketFactory : Creating SSL Socket with remote cloud.wowspace.it:443, local null:0, params: org.apache.commons.httpclient.params.HttpConnectionParams@8fc0d51

2018/12/05 00:39:04
AdvancedSslSocketFactory :  ... with connection timeout 60000 and socket timeout 60000

2018/12/05 00:39:04
ServerNameIndicator : SNI done, hostname: cloud.wowspace.it

2018/12/05 00:39:04
AdvancedSslSocketFactory : Creating SSL Socket with remote cloud.wowspace.it:443, local null:0, params: org.apache.commons.httpclient.params.HttpConnectionParams@698b42

2018/12/05 00:39:04
AdvancedSslSocketFactory :  ... with connection timeout 60000 and socket timeout 60000

2018/12/05 00:39:04
ServerNameIndicator : SNI done, hostname: cloud.wowspace.it

2018/12/05 00:39:04
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:04
OwnCloudClient #6 : REQUEST GET /index.php/204

2018/12/05 00:39:04
OwnCloudClient #3 : REQUEST POST /ocs/v2.php/apps/notifications/api/v2/push

2018/12/05 00:39:04
OwnCloudClient #7 : Creating OwnCloudClient

2018/12/05 00:39:04
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:04
OwnCloudClient #7 : REQUEST GET /index.php/204

2018/12/05 00:39:04
OwnCloudClient #8 : Creating OwnCloudClient

2018/12/05 00:39:04
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:04
OwnCloudClient #8 : REQUEST GET /index.php/204

2018/12/05 00:39:04
RegisterAccountDeviceForNotificationsOperation : Exception while registering device for notifications Exception : [com.google.gson.JsonObject.getAsJsonObject(JsonObject.java:205), com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForNotificationsOperation.isInvalidSessionToken(RegisterAccountDeviceForNotificationsOperation.java:139), com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForNotificationsOperation.run(RegisterAccountDeviceForNotificationsOperation.java:106), com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:145), com.owncloud.android.lib.common.operations.RemoteOperation.execute(RemoteOperation.java:149), com.owncloud.android.utils.PushUtils.pushRegistrationToServer(PushUtils.java:236), com.owncloud.android.ui.activity.FileDisplayActivity.onMessageEvent(FileDisplayActivity.java:2528), java.lang.reflect.Method.invoke(Native Method), org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:485), org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:479), org.greenrobot.eventbus.BackgroundPoster.run(BackgroundPoster.java:64), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607), java.lang.Thread.run(Thread.java:761)]

2018/12/05 00:39:04
ArbitraryDataProvider : Updating arbitrary data with cloud id: global key: media_folders value: {"imageMediaFolders":["/storage/emulated/0/DCIM/Camera","/storage/emulated/0/WhatsApp/Media/WhatsApp Profile Photos","/storage/emulated/0/Pictures/reddit_sync","/storage/emulated/0/DCIM/Camera","/storage/emulated/0/WhatsApp/Media/WhatsApp Animated Gifs"],"videoMediaFolders":[]}

2018/12/05 00:39:04
FileActivity : Operations service connected

2018/12/05 00:39:04
FileDisplayActivity : Download service connected

2018/12/05 00:39:04
OwnCloudClient #9 : Creating OwnCloudClient

2018/12/05 00:39:04
AccountUtils : Restoring cookies for USERNAME@cloud.wowspace.it

2018/12/05 00:39:04
OwnCloudClient #9 : REQUEST GET /index.php/204

2018/12/05 00:39:04
FileDisplayActivity : Upload service connected

2018/12/05 00:39:12
DrawerActivity : Unknown drawer menu item clicked: Settings

2018/12/05 00:39:12
FileDisplayActivity : onPause() start

2018/12/05 00:39:12
FileDisplayActivity : onPause() ending

2018/12/05 00:39:12
FileDisplayActivity : onPause() end

2018/12/05 00:39:12
Preferences : onCreate(Bundle) starting

2018/12/05 00:39:12
Preferences : onStart() starting

2018/12/05 00:39:12
Preferences : onResume() starting

2018/12/05 00:39:12
FileDisplayActivity : onSaveInstanceState() start

2018/12/05 00:39:12
FileDisplayActivity : onSaveInstanceState(Bundle) starting

2018/12/05 00:39:12
ExtendedListFragment : onSaveInstanceState()

2018/12/05 00:39:12
FileDisplayActivity : onSaveInstanceState() end

2018/12/05 00:39:12
FileDisplayActivity : onStop() ending

2018/12/05 00:39:14
Preferences : onPause() ending

2018/12/05 00:39:14
LogHistoryActivity : onCreate(Bundle) starting

2018/12/05 00:39:14
LogHistoryActivity : onStart() starting

2018/12/05 00:39:14
LogHistoryActivity : onResume() starting

2018/12/05 00:39:15
Preferences : onSaveInstanceState(Bundle) starting

2018/12/05 00:39:15
Preferences : onStop() ending

2018/12/05 00:41:46
LogHistoryActivity : onPause() ending

2018/12/05 00:41:52
LogHistoryActivity : onSaveInstanceState(Bundle) starting

2018/12/05 00:41:52
LogHistoryActivity : onStop() ending

2018/12/05 00:42:04
BaseActivity : onRestart() start

2018/12/05 00:42:04
BaseActivity : onRestart() end

2018/12/05 00:42:04
LogHistoryActivity : onStart() starting

2018/12/05 00:42:04
LogHistoryActivity : onResume() starting

Found
https://cloud.wowspace.it/remote.php/webdav/
address in
https://cloud.wowspace.it/index.php/apps/files

but even using that failed

./rclone -vv --dump bodies ls fw:
2018/12/06 09:52:26 DEBUG : rclone: Version "v1.45-021-g26b5f55c-beta" starting with parameters ["./rclone" "-vv" "--dump" "bodies" "ls" "fw:"]
2018/12/06 09:52:26 DEBUG : Using config file from "/home/alberto/.config/rclone/rclone.conf"
2018/12/06 09:52:26 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2018/12/06 09:52:26 DEBUG : HTTP REQUEST (req 0xc0003e9000)
2018/12/06 09:52:26 DEBUG : PROPFIND /remote.php/webdav/ HTTP/1.1
Host: cloud.wowspace.it
User-Agent: rclone/v1.45-021-g26b5f55c-beta
Authorization: XXXX
Depth: 1
Accept-Encoding: gzip

2018/12/06 09:52:26 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2018/12/06 09:52:26 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2018/12/06 09:52:26 DEBUG : HTTP RESPONSE (req 0xc0003e9000)
2018/12/06 09:52:26 DEBUG : HTTP/1.1 401 Unauthorized
Content-Length: 343
Cache-Control: no-store, no-cache, must-revalidate
Content-Security-Policy: default-src 'none';
Content-Type: application/xml; charset=utf-8
Date: Thu, 06 Dec 2018 08:52:26 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Server: Apache/2.4.25 (Debian)
Set-Cookie: ocvbd8xv1bpp=41724988db338d4c6ee36bfe7e6f534f; path=/; secure; HttpOnly
Set-Cookie: oc_sessionPassphrase=ba%2BHW0eOFEMhSIDNyq3YyK2dpjvFC9TEd0AM0HNACntYhQW4TBcCOnArpg29UjrIP45PgawYUEvkIs4HJYtQnJipo9N4cC7pfVMdTWhtm4LOFExoI7oOvzGx7RE60gOx; path=/; secure; HttpOnly
Set-Cookie: __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
Set-Cookie: __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
Set-Cookie: ocvbd8xv1bpp=e62d38e4fff2cac347f7270ca694f298; path=/; secure; HttpOnly
Set-Cookie: 4fc365d3a4737d8f1f3184800a0a0d1f=a5120f20ed7bdf7b20905b51cc8c0683; path=/; HttpOnly; Secure
Www-Authenticate: Basic realm="WOW Space"
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Powered-By: PHP/7.2.12
X-Robots-Tag: none
X-Xss-Protection: 1; mode=block

<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
  <s:message>Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured</s:message>
</d:error>
2018/12/06 09:52:26 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2018/12/06 09:52:26 ERROR : : error listing: couldn't list files: Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured: Sabre\DAV\Exception\NotAuthenticated: 401 Unauthorized
2018/12/06 09:52:26 Failed to ls: couldn't list files: Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured: Sabre\DAV\Exception\NotAuthenticated: 401 Unauthorized

BTW, send you an e-mail.

Hi, I did some more test with curl.

curl -X PUT "https://cloud.wowspace.it/remote.php/webdav/$DIR/$FILE" --data-binary @"./$FILE" -u $USR:$PSW 
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
  <s:message>Username or password was incorrect, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured</s:message>
</d:error>

Then I tried with the cookie extracted from my browser session.

curl -X PUT "https://cloud.wowspace.it/remote.php/webdav/$DIR/$FILE" --data-binary @"./$FILE" --cookie cookies.txt
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
  <s:message>CSRF check not passed.</s:message>
</d:error>

Then I tried with requesttoken

curl -X PUT "https://cloud.wowspace.it/remote.php/webdav/$DIR/$FILE" --data-binary @"./$FILE" -H 'requesttoken: 18CHARS+18CHARS+5CHARS=:43CHARS='
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
  <s:message>No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured</s:message>
</d:error>

Finally requesttoken and cookie

curl -X PUT "https://cloud.wowspace.it/remote.php/webdav/$DIR/$FILE" --data-binary @"./$FILE" -H 'requesttoken: 18CHARS+18CHARS+5CHARS=:43CHARS=' --cookie cookies.txt

worked

Don’t know if it can help.

thanks

cookies.txt redactect
# HTTP Cookie File downloaded with cookies.txt by Genuinous @genuinous
# This file can be used by wget, curl, aria2c and other standard compliant tools.
# Usage Examples:
#   1) wget -x --load-cookies cookies.txt "https://cloud.wowspace.it/index.php/apps/fastweb/#/trashbin"
#   2) curl --cookie cookies.txt "https://cloud.wowspace.it/index.php/apps/fastweb/#/trashbin"
#   3) aria2c --load-cookies cookies.txt "https://cloud.wowspace.it/index.php/apps/fastweb/#/trashbin"
#
cloud.wowspace.it	FALSE	/	TRUE	0	12CHARS	33CHARS
cloud.wowspace.it	FALSE	/	TRUE	0	oc_sessionPassphrase	13CHARS%2B18CHARS%2B34CHARS%2F7CHARS%2B4CHARS%2F19CHARS%2B8CHARS%2B%2B7CHARS%2BD%2F7CHARS
cloud.wowspace.it	FALSE	/	TRUE	4133980799	__Host-nc_sameSiteCookielax	true
cloud.wowspace.it	FALSE	/	TRUE	4133980799	__Host-nc_sameSiteCookiestrict	true
cloud.wowspace.it	FALSE	/	TRUE	0	32CHARS	32CHARS
cloud.wowspace.it	FALSE	/	FALSE	0	fastweb_profile	{%22id%22:4963531%2C%22name%22:%22REDACTED%22%2C%22mtime%22:1543945191%2C%22hdd%22:{%22usedSpace%22:9528697101%2C%22freeSpace%22:-2}%2C%22etag%22:%225c06bbe7cffa0%22%2C%22avatar%22:%22/index.php/core/preview.png?file=/REDACTED/Avatar.jpg&amp;x=156&amp;y=156&amp;a=1&amp;mode=cover%22}

Ah ha! Well done.

If you look at the way sharepoint is authenticated you can see it does something similar.

So it would be possible to build this into rclone. Do you want to have a go?

Did you find out which cookie was the important one?

Sorry, no experience in golang or programming.
Don’t get it, there are more cookies?

BTW, did you have a run with my credentials?

OK!

There are several cookies in the file you posted above - I just wondered if you’d worked out which one was the needed one?

Sorry, I haven’t had time yet :frowning:

fastweb_profile can be omitted, if I comment the others I get either 401 or 503

Another thing:

curl -s -L --post302 https://cloud.wowspace.it/index.php --user-agent "$UA" --cookie cookies.txt | grep data-requesttoken | cut -d\" -f 6

give me a valid requesttoken

So I will try to implement it in golang as a proof of concept

Also
https://github.com/nextcloud/server/issues/7062#issuecomment-342416653

SSO for WebDAV is not supported at the moment. To use SSO in WebDAV you need to use the client login flow that we’re currently implementing in our clients. – However, native WebDAV clients likely won’t support our flow.

That would be fantastic :smile:

Any news on this topic?

Good news.
After logging in with nextcloud (or owncloud) desktop client a password is saved in the keyring. Using that password you can login using webdav.

I tested it and it works.
Extract the password from the keyring and your are fine.

On linux gnome-keyring you can use
secret-tool search --all --unlock server "Nextcloud"

on windows you can use CredentialsFileView

on macos open the Keychain Access.

So I think this could be closed

thanks

1 Like

Ah ha!

Is this worth a paragraph in the docs do you think?

Fancy writing one and sending a pull request?

Hi @falafel,

can you explain better how have you resolved? I tried to create my user putting the password from secret-tool without any success.

Thanks,

luigi

Eureka!

Steps:

  • Access to Fastweb Wowspace using the Nextcloud client

  • Catch passord using secret-tool search

  • Create a configuration like:

    [wowspace]
    type = webdav
    url = https://cloud.wowspace.it/remote.php/webdav/
    vendor = nextcloud
    user =my-user
    pass = encrypted-password

1 Like