Ticket #494 (reopened defect)

Opened 7 years ago

Last modified 6 years ago

Google: 401 Token invalid

Reported by: fers Owned by: ehabkost
Priority: normal Milestone:
Component: Plugin: google Version: 0.22
Severity: normal Keywords:
Cc:

Description (last modified by felixmoeller) (diff)

I am syncing google with evolution. It downloads items from Google and adds them to evolution. But the opposite didn't work. I can see for every item this:

add gdata: 
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005"><title type="text">Rosa Parks refuses to move to back of the bus (Mon</title><content type="text"></content><gd:when endTime="2003-12-01" startTime="2003-12-01"/><gd:where valueString=""/></entry>
Http error: 401: Token invalid
{'status': '401', 'content-length': '149', 'server': 'GFE/1.3', 'cache-control': 'private', 'date': 'Thu, 10 May 2007 12:48:00 GMT', 'content-type': 'text/html; charset=UTF-8', 'www-authenticate': 'GoogleLogin realm="https://www.google.com/accounts/ClientLogin", service="cl"'}
Error writing entry http%3a%2f%2fwww%2egoogle%2ecom%2fcalendar%2ffeeds%2fXXXX%2540XXXXXX%2eXXX%2fprivate%2ffull%2fee6onfvngatgtlugilealpu1lk to member 2: Couldn't read from helper
Mapping Write Error: Couldn't read from helper
osync to xs: 20031110T000000 => 2003-11-10T00:00:00
osync to xs: 20031110T000000 => 2003-11-10T00:00:00

I am using version 0.22-feisty1 from:

deb http://www.in.fh-merseburg.de/~jahn/opensync-0.21/ feisty main

Do you need any further information?

Change History

comment:1 Changed 7 years ago by fers

It seems that few items were uploaded (ie problem is with the content of the message).

comment:2 Changed 7 years ago by boesswetter

Hi,

I was about to open a ticket for this topic when I saw this one :)

@fers: The reason is not in the content, but in the number of events that you try to sync (probably in the hundreds?)

I had the same problem and I think I found the reason: since the google-cal-helper is called for every event to be processed, each invocation authenticates itself via HTTP basic auth. Obviously, Google tries to prevent brute force attacks by prohibiting more than a few logins per time and user and requires Captcha-Authentication for further requests (which isn't very useful for batch-processing).

So I changed the helper to use the recommended ClientLogin? mechanism. Of course, this does not solve the problem, because still a new token ist retrieved for each event, but for testing purposes I tried a hardcoded token (generated by hand) which is then used for all events, resulting in no more 401 errors.

I'm working on a useable solution, but it's probably going to be ugly (save the token to a file and read it on next invocation? Or send the token to the calling process for latter retrieval? Hm...). The cleanest solution would be to call the helper only once (for all events), but since it's a temporary solution anyway, it's probably not worth the trouble.

Best regards, Daniel

comment:3 Changed 7 years ago by boesswetter

  • Status changed from new to closed
  • Resolution set to worksforme

Hi,

I patched version 0.22 to circumvent this problem. I introduced a second helper to obtain a token (from Google ClientLogin?) which is then passed to consecutive calls to google-cal-helper.

The patch can be found at

http://www.daniel-boesswetter.de/download/libopensync-plugin-google-calendar-0.22-db1.patch.gz

Untar the 0.22 sources, cd into the directory an apply the patch with "patch -p 1 < path_to.patch".

Hope it helps (for me it does).

Regards, Daniel

comment:4 Changed 7 years ago by boesswetter

  • Status changed from closed to reopened
  • Resolution worksforme deleted

comment:5 Changed 6 years ago by romain.wartel

I have facing the same problem (many entries in my calendar, 401 error).

Unfortunately the patch has not resolved the issue.

$ msynctool --sync google Synchronizing group "google" The previous synchronization was unclean. Slow-syncing Traceback (most recent call last):

File "/usr/local/libexec/google-login-helper", line 48, in <module>

key, val = l.split("=")

ValueError?: too many values to unpack reading password from helper: File exists Member 1 of type google-calendar just connected received event dsession Member 2 of type syncml-obex-client just connected All clients connected or error Member 1 of type google-calendar had an error while getting changes: Couldn't write token to gchelper Member 1 of type google-calendar just disconnected Received an reply to our Alert Going to receive 396 changes Received an entry 2 with data of size 4 from member 2. Changetype ADDED Received an entry 3 with data of size 4 from member 2. Changetype ADDED Received an entry 4 with data of size 4 from member 2. Changetype ADDED Received an entry 5 with data of size 4 from member 2. Changetype ADDED <SNIP> Received an entry 417 with data of size 4 from member 2. Changetype ADDED Received an entry 418 with data of size 4 from member 2. Changetype ADDED Member 2 of type syncml-obex-client just sent all changes Member 2 of type syncml-obex-client just disconnected All clients have disconnected The sync failed: Unable to read from one of the members Error synchronizing: Unable to read from one of the members Pipe closed! Exiting. Pipe closed! Exiting.

Any view?

comment:6 Changed 6 years ago by felixmoeller

  • Description modified (diff)
Note: See TracTickets for help on using tickets.