etesync / etesync-dav

This is a CalDAV and CardDAV adapter for EteSync
https://www.etesync.com
GNU General Public License v3.0
290 stars 47 forks source link

Thunderbird not syncing: UNAUTHORIZED Auth Token #164

Closed CodingCellist closed 4 years ago

CodingCellist commented 4 years ago

Issue

I recently noticed that events I had created were not being synced to etesync. When checking my logs, I found the following:

[ERROR] UNAUTHORIZED auth token
Traceback (most recent call last):
  File "etesync_dav/radicale/storage.py", line 78, in run
  File "etesync/api.py", line 142, in sync
  File "etesync/api.py", line 121, in get_or_create_user_info
  File "etesync/service.py", line 280, in get
  File "etesync/service.py", line 164, in _validate_response
etesync.exceptions.UnauthorizedException: UNAUTHORIZED auth token

I initially thought it might be because I hadn't updated the linux-etesync-dav binary in a while, but even with the latest version (0.20.3), the issue persists.

I can see my account fine on the localhost, and I am able to log in using etesync-web, but there are no events in my calendar, as they don't seem to sync.

Setup

tasn commented 4 years ago

I understand what's going on, but it's weird it hasn't happened to others before. Essentially your auth token has expired, and it needs to be refreshed, but there's not currently a way of achieving that! Give me a second and I'll figure out a solution!

Doesn't Thunderbird show you a nice error message about it failing to sync?

tasn commented 4 years ago

I'm pushing out a new version with a workaround in a moment. I also see why it didn't show you a proper error message in Thunderbird. Both a proper fix for this, and the error message issue will be released in etesync 2.0 in the next few weeks (hopefully).

In the meanwhile, what you need to do is:

  1. Update to etesync-dav 0.20.4
  2. Log into the web ui

It should now work. If it doesn't restart etesync-dav and then it will work.

Sorry for the trouble!

CodingCellist commented 4 years ago

Restarting with the latest version solved it. Thank you so much for the extremely rapid response!

As you seem to have found out, Thunderbird did not show any nice error message. In fact, it seemed to be quite happy, as if it had synced. That was what seemed so odd about it.

How long do the auth tokens last? Should I be logging in intermittently, e.g. once a month, to keep the token fresh?

tasn commented 4 years ago

Yeah, I know why Thunderbird hasn't complained, and it's not their fault, it's etesync-dav's. One of the optimisations we introduced made it silently fail in some cases. I have a big fat note about it and I already know how to fix it.

Auth tokens last indefinitely as long as they are used, and by used I mean etesync-dav is running. They expire if they haven't been used in 14 days or more.