Sync cal+contacts mobile

Hello, I’m not sure if this is the right place to post this so apologies in advance.

I’m having a problem syncing my contacts+calendar from opendesktop to my mobile phone (Volla OS, Android 10).
I followed this guide and all is OK until after granting access in the Nextcloud app.
I get the “Account connected” message and close the window.
After closing DavX pops up and tries to connect to my opendesktop account, but than I get the message that “no calDav/cardDav service was found”.
After a second or so I get the Nextcloud app again, asking to connect my account again. From here on it’s an endless loop.

Hope it’s clear what the problem is, is there any solution ?

Thanks,
Bart.

Having the same issue trying to do that today. So far no luck.

in the logs for davx5, it shows that it is trying to connect to
/remote.php/dav/principals/users/<myusername>
and says it “doesn’t provide required caldav service”
though when i go to that url with browser, it loads and show this message:
This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.
Not sure, maybe some kind of misconfiguration on the server?

I have the Nextcloud calendar synced via Kalendar (uses Akonadi to sync) with no issues:

I will look into these issues though. I’m installing DavX5 on my phone now.

OK it’s a paid app. Try the URL in my config (replacing justinz with your own OpenDesktop username) and let me know if that works.

It is open source so it was free on F-Droid. I’ve installed it and set it up, I’m seeing it listed in my Google Calendar app now.

Hi justinz,
thank you for looking into it. that does work for setting up one particular calendar, and then has to be repeated for each individual calenadar.
but according to nextcloud docs, and davx5 docs, pointing to just host/remote.php/dav should discover all the calendars, but that does not work.
the nextcloud docs here:
https://docs.nextcloud.com/server/21/user_manual/en/pim/sync_android.html#without-the-nextcloud-mobile-app
and davx5 docs here:

both suggest that the base url should just be server/remote.php/dav

i did a bit of digging, and it looks like it’s a configuration issue, such that listing of calendars is disabled. when i use curl to interact with the caldav baseurl at /remote.php/dav:
curl --user nanotube:**** -X PROPFIND https://my.opendesktop.org/remote.php/dav -v 2>&1
it works fine, and returns many things along with the availability of /remote.php/dav/calendars/
then I curl that calendars endpoint with PROPFIND, it returns
<s:message>Listing members of this collection is disabled</s:message>

I don’t know enough about nextcloud configs/permissions that are required to enable this, and some cursory websearch did not return anything specific, so… this is as far as I can take it at the moment. :slight_smile:
it would be great if you could fix this so that i don’t have to add each of my calendars individually…

thank you!

Thank you for the digging. I’ll have a look into it, it might be a setting within Nextcloud.

After a bit of tinkering and searching, I came across a post from 2014 that mentioned putting the username after the calenders section as without it you’re trying to list all users.

I tried using the username appended in Davx5 but it didn’t work, but I can use it in Kalendar and in curl (see below) and it lists the available calendars.

curl -k --user "username:password" -X PROPFIND -H "Content-Type: application/xml" "https://my.opendesktop.org/remote.php/caldav/calendars/username/" | xmllint -format -

So it seems like this might be in issue in Davx5 and how they implement CalDav via Nextcloud.

Hm, interesting, I can reproduce your results that pointing to …calendars/username returns a list with curl, and also that davx5 doesn’t grok it.
The nextcloud docs also suggest that pointing to /remote.php/dav/ directly should work. I would think that the overall calendar list would be user-specific due to the authentication with username… I guess to double check if it’s some configuration issue, or a documentation issue, i need to try this with a different nextcloud install to see if it behaves differently. perhaps tomorrow i’ll give it a try. :slight_smile:
thank you for replies, will let you know what i find!

Ok, I see this thread got some momentum :slightly_smiling_face:

I don’t really have much to add to this for now, I can verify that desktop clients sync without problem.
I’m using Kontact (Kalender, Akonadi) with just the base URL and it syncs calendar and contacts.

It’s the mobile side only that gives problems. So I’m guessing it’s more of a DavX issue than ?
I managed to grab some debug logs from the app:

2022-01-17 11:22:01 3400 [ui.setup.DavResourceFinder] Found current-user-principal: https://my.opendesktop.org/remote.php/dav/principals/users/<my-username>/
2022-01-17 11:22:01 3400 [HttpClient] --> OPTIONS https://my.opendesktop.org/remote.php/dav/principals/users/<my-username>/ h2
2022-01-17 11:22:01 3400 [HttpClient] Content-Length: 0
2022-01-17 11:22:01 3400 [HttpClient] User-Agent: DAVx5/4.1-ose (2021/12/29; dav4jvm; okhttp/4.9.1) Android/10
2022-01-17 11:22:01 3400 [HttpClient] Accept-Language: en-GB, en;q=0.7, *;q=0.5
2022-01-17 11:22:01 3400 [HttpClient] Host: my.opendesktop.org
2022-01-17 11:22:01 3400 [HttpClient] Connection: Keep-Alive
2022-01-17 11:22:01 3400 [HttpClient] Accept-Encoding: gzip
...
2022-01-17 11:22:01 3400 [HttpClient] --> END OPTIONS
2022-01-17 11:22:01 3400 [HttpClient] <-- 200
...
2022-01-17 11:22:01 3400 [HttpClient] <-- END HTTP (0-byte body)
2022-01-17 11:22:01 3400 [ui.setup.DavResourceFinder] https://my.opendesktop.org/remote.php/dav/principals/users/<my-username>/ doesn't provide required caldav service
2022-01-17 11:22:01 3400 [ui.setup.DavResourceFinder] Trying to determine principal from initial context path=https://my.opendesktop.org/
2022-01-17 11:22:01 3400 [HttpClient] --> PROPFIND https://my.opendesktop.org/ h2
2022-01-17 11:22:01 3400 [HttpClient] Depth: 0
2022-01-17 11:22:01 3400 [HttpClient] User-Agent: DAVx5/4.1-ose (2021/12/29; dav4jvm; okhttp/4.9.1) Android/10
2022-01-17 11:22:01 3400 [HttpClient] Accept-Language: en-GB, en;q=0.7, *;q=0.5
2022-01-17 11:22:01 3400 [HttpClient] Content-Type: application/xml; charset=utf-8
2022-01-17 11:22:01 3400 [HttpClient] Content-Length: 198
2022-01-17 11:22:01 3400 [HttpClient] Host: my.opendesktop.org
2022-01-17 11:22:01 3400 [HttpClient] Connection: Keep-Alive
2022-01-17 11:22:01 3400 [HttpClient] Accept-Encoding: gzip
...
2022-01-17 11:22:01 3400 [HttpClient] --> END PROPFIND (198-byte body)
2022-01-17 11:22:02 3400 [HttpClient] <-- 405 https://my.opendesktop.org/ (97ms)
2022-01-17 11:22:02 3400 [HttpClient] server: nginx
2022-01-17 11:22:02 3400 [HttpClient] date: Mon, 17 Jan 2022 10:22:01 GMT
2022-01-17 11:22:02 3400 [HttpClient] content-type: text/html; charset=UTF-8
2022-01-17 11:22:02 3400 [HttpClient] content-length: 0
2022-01-17 11:22:02 3400 [HttpClient] referrer-policy: no-referrer
2022-01-17 11:22:02 3400 [HttpClient] x-content-type-options: nosniff
2022-01-17 11:22:02 3400 [HttpClient] x-download-options: noopen
2022-01-17 11:22:02 3400 [HttpClient] x-frame-options: SAMEORIGIN
2022-01-17 11:22:02 3400 [HttpClient] x-permitted-cross-domain-policies: none
2022-01-17 11:22:02 3400 [HttpClient] x-robots-tag: none
2022-01-17 11:22:02 3400 [HttpClient] x-xss-protection: 1; mode=block
2022-01-17 11:22:02 3400 [HttpClient] expires: Thu, 19 Nov 1981 08:52:00 GMT
2022-01-17 11:22:02 3400 [HttpClient] cache-control: no-store, no-cache, must-revalidate
2022-01-17 11:22:02 3400 [HttpClient] pragma: no-cache
2022-01-17 11:22:02 3400 [HttpClient] content-security-policy: default-src 'self'; script-src 'self' 'nonce-eS9rM2QrbzJqS2hXanJHYnlaREhVTTV2UzQ5ZEdWMEZsbnN6WENveWRUTT06aFp0VEE0TnoyOUU0L043UzV1VDBKcFlwS1BzUlh4dGo4QXByT1Yxb0YyST0='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';
2022-01-17 11:22:02 3400 [HttpClient] strict-transport-security: max-age=31536000
2022-01-17 11:22:02 3400 [HttpClient] <-- END HTTP (0-byte body)
2022-01-17 11:22:02 3400 [ui.setup.DavResourceFinder] No resource found
EXCEPTION at.bitfire.dav4jvm.exception.HttpException: HTTP 405 
	at at.bitfire.dav4jvm.DavResource.checkStatus(DavResource.kt:5)
	at at.bitfire.dav4jvm.DavResource.checkStatus(DavResource.kt:3)
	at at.bitfire.dav4jvm.DavResource.processMultiStatus(DavResource.kt:1)
	at at.bitfire.dav4jvm.DavResource.propfind(DavResource.kt:11)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.getCurrentUserPrincipal(DavResourceFinder.kt:2)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.discoverPrincipalUrl(DavResourceFinder.kt:28)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.findInitialConfiguration(DavResourceFinder.kt:32)
	at at.bitfire.davdroid.ui.setup.DavResourceFinder.findInitialConfiguration(DavResourceFinder.kt:4)
	at at.bitfire.davdroid.ui.setup.DetectConfigurationFragment$DetectConfigurationModel$detectConfiguration$2.invoke(DetectConfigurationFragment.kt:6)
	at at.bitfire.davdroid.ui.setup.DetectConfigurationFragment$DetectConfigurationModel$detectConfiguration$2.invoke(DetectConfigurationFragment.kt:1)
	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:1)

Thanks.
Bart.

well… i got a free nextcloud account at opsone-cloud.ch and created a couple calendars, then pointed davx5 at /remote.php/dav and… it worked like magic, and showed me all my calendars and contacts list in one fell swoop.
that said, curling remote.php/dav/calendars on that server still gives a ‘listing members not allowed’. so i’m not sure exactly what is different about the other nextcloud config relative to opendesktop, but, definitely there is something different. :slight_smile:

Me again :slightly_smiling_face:

I posted my debug logs to DavX5 support form and received this reply from them:

Hi Bart,

thanks for the log. It seems that the OPTIONS request during the connection process does not return a DAV capability. So DAVx5 does not know that there is a DAV server running on https://my.opendesktop.org/remote.php/dav/ and thus can’t connect.

Maybe a webserver problem of nginx…

You need to report this to the admin responsible for configuring the webserver.

Hope that helps!

Best regards,
Bernhard Stockmann

Is this sufficient enough information ? Can it be solved ?

TIA
Bart.

Good info, Bart!
I checked by sending the OPTIONS command via curl, to opendesktop.org nextcloud, and to another nextcloud instance on opsone-cloud, and indeed the opendesktop does not return any info, while the other one returns info on dav capabilities. hopefully this will be enough to get this issue resolved.

Hi, can I get an update on this ?
@justinz is this something you can do, or delegate ?

TIA
Bart.

I’ll look into the config of the webserver and let you know.

I don’t think the issue is fixed (yet), but I have found a workaround that at least seems to work in the Davx5 app (free from F-Droid store).

In the field of the base URL, use https://my.opendesktop.org/remote.php/dav/principals/users/<username>/ and everything will load! (CalDAV + tasks, CardDAV,).

(After adding the account, select which clendars, contact lists, etc. you want to show and then manually sync it by hitting the sync button). I hope this helps until things are fixed.

Thanks that does work I just tested! I’m still working on getting it to work OOTB without any workarounds but I can’t find the way I resolved it last time.

I’m glad to have been of help. I’m guessing that this workaround will always work, as it is a legitimate CalDAV query which returns the type of data needed for the endpoint to work.

I think you’re right there.