calcurse icon indicating copy to clipboard operation
calcurse copied to clipboard

403 (Forbidden) received from Google when Todo's are present even though SyncFilter is set to only 'cal'

Open ghost opened this issue 7 years ago • 13 comments
trafficstars

  • If I remove all Todo's, Calendar syncs just fine. Once I add a Todo item I get the 403 error below.

  • Config file states "SyncFilter = cal"

calcurse-caldav --debug -v truncated output: <D:href>/caldav/v2/[email protected]/events/37e11750ff42d8b134ab48a2b4bc8c8d17fb62b9.ics</D:href> < <D:propstat> < <D:status>HTTP/1.1 200 OK</D:status> < <D:prop> < <D:getetag>"63672587396"</D:getetag> < </D:prop> < </D:propstat> < </D:response> < <D:response xmlns:carddav="urn:ietf:params:xml:ns:carddav" xmlns:cm="http://cal.me.com/_namespace/" xmlns:md="urn:mobileme:davservices"> < <D:href>/caldav/v2/[email protected]/events/9b881782217a5bef88e2da5d239798fd01db0a13.ics</D:href> < <D:propstat> < <D:status>HTTP/1.1 200 OK</D:status> < <D:prop> < <D:getetag>"63672586325"</D:getetag> < </D:prop> < </D:propstat> < </D:response> < </D:multistatus>

Pushing new object 245378cff61313848172e76be49f2ac3f606d894 to the server.

PUT https://apidata.googleusercontent.com/caldav/v2/[email protected]/events/245378cff61313848172e76be49f2ac3f606d894.ics Headers: {'user-agent': 'Mac_OS_X/10.13.6 (13C64) CalendarAgent/176', 'Content-Type': 'text/calendar; charset=utf-8'} BEGIN:VCALENDAR PRODID:-//calcurse//NONSGML v4.3.0//EN VERSION:2.0 BEGIN:VTODO PRIORITY:2 SUMMARY:Call Bill UID:245378cff61313848172e76be49f2ac3f606d894 END:VTODO END:VCALENDAR

< Headers: {'vary': 'Origin, X-Origin', 'content-type': 'text/xml; charset=UTF-8', 'date': 'Mon, 17 Sep 2018 02:10:11 GMT', 'expires': 'Mon, 17 Sep 2018 02:10:11 GMT', 'cache-control': 'private, max-age=0', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'server': 'GSE', 'alt-svc': 'quic=":443"; ma=2592000; v="44,43,39,35"', 'transfer-encoding': 'chunked', 'status': '403', 'content-length': '65', '-content-encoding': 'gzip'} < < <D:error xmlns:D="DAV:"/>

error: The server at apidata.googleusercontent.com replied with HTTP status code error: 403 (Forbidden) while trying to access https://apidata.googleusercontent. error: com/caldav/v2/[email protected]/events error: /245378cff61313848172e76be49f2ac3f606d894.ics.

Config File: [General] Binary = calcurse Hostname = apidata.googleusercontent.com Path = /caldav/v2/[email protected]/events/ AuthMethod = oauth2 InsecureSSL = No

SyncFilter = cal

DryRun = No Verbose = Yes

#[Auth] #Username = user #Password = pass

[CustomHeaders] User-Agent = Mac_OS_X/10.13.6 (13C64) CalendarAgent/176

[OAuth2] ClientID = xxxx.apps.googleusercontent.com ClientSecret = xxxx Scope = https://www.googleapis.com/auth/calendar RedirectURI = http://127.0.0.1

ghost avatar Sep 17 '18 02:09 ghost

I have the same issue even though I do not use gcal. Removing the local TODO items silences the error as well.

mtreca avatar Sep 22 '18 20:09 mtreca

I concur. Not using todo's in calcurse silences the error but this means todo functionality is lost from my calcurse installation.

ghost avatar Sep 23 '18 11:09 ghost

Looks like this is a duplicate of my report here https://github.com/lfos/calcurse/issues/129

I haven't tested the new version mentioned in the comment there yet though. Are you able to test the new version mentioned in my report @peterski007 ?

loweryaustin avatar Dec 12 '18 23:12 loweryaustin

Same here, the 'cal' filter does not work. I hope to do a pull request for this, I would like this to be fixed ASAP, because CalCurse is the one tool I most desperately need in my life.

pearupung avatar Jan 17 '19 16:01 pearupung

If I call python3 calcurse-caldav then everything works as expected. When I try to run it as an executable calcurse-caldav then things run amock, I get a 403 and I cannot get some printed strings even if I append the debug flag to the command. I guess we have to update our calendars via the interpreter then.

It is funny, because shebang does not urge other python executables to run, for example

/usr/bin$ cat test
#!/usr/bin/env python3
print("hello!")
/usr/bin/$ test

results in no output. However python3 test works just fine, printing "hello" to stdout.

Maybe it is an Ubuntu 18.04 thing, but if anyone has a clue why it is so, then please notify me.

pearupung avatar Jan 17 '19 19:01 pearupung

So, a workaround is to add an alias to your ~/.bashrc file, logout and login: alias cursecal='python3 /usr/bin/calcurse-caldav; calcurse; python3 /usr/bin/calcurse-caldav' This provides automatic syncing on opening and closing the calcurse app every time one types cursecal into the terminal.

pearupung avatar Jan 17 '19 19:01 pearupung

Also, sorry for the spam, but I think the tarball downloadable from the website did not had any sync_filter variable in the calcurse-caldav.py file as is in the source of this repository. I do not know if this is of any relevance.

pearupung avatar Jan 17 '19 19:01 pearupung

The sync_filter option is new and not part of a release. Did you verify that you also have the issue when running a development snapshot of calcurse (current master)?

The shebang thing sounds like a system config issue to me. What happens if you run env python3 test with the test script above? If that prints nothing, something is wrong with your environment setup.

lfos avatar Jan 17 '19 20:01 lfos

Current master works with python3 calcurse-caldav on my Ubuntu 18.04 and typing env python3 /usr/bin/test prints out "hello", but master still produces 403 when running calcurse-caldav in terminal due to the caldav service trying to push notes to my Google calendar. Still, debugging is painful, because I get only those debug messages shown in the first comment of this thread (other debug prints apparently do not execute or are not streamed to my terminal window).

My first suspicion is that calcurse -G filter... command does not filter out note type events making the returned hashset invalid, but that is just a hunch, a gut feeling without the proper tools to investigate. When I try out the command in a similar fashion on my own in the terminal, everything seems fine - all todo events are filtered out.

Have you got any recommendations how to have some oversight over caldav's actions?

pearupung avatar Jan 17 '19 21:01 pearupung

You can run calcurse-caldav in debug mode by adding --debug to the invocation. That prints all HTTP requests and responses.

What do you mean by "note type events"?

lfos avatar Jan 19 '19 14:01 lfos

Here is the req that failed

New sync database entry: /caldav/v2/***@gmail.com/events/9b3ca641***339.ics 63***63067 9b3ca641***19cf7f0d339
Pushing new object 54a61029***7dd3e78c095c3 to the server.
Running command: ['calcurse', '-xical', '--export-uid', '--filter-hash=54a610297f163***dd3e78c095c3']
> PUT https://apidata.googleusercontent.com/caldav/v2/***@gmail.com/events/54a6102***b454c4a6c1***8c095c3.ics
> Headers: {'Content-Type': 'text/calendar; charset=utf-8'}
> BEGIN:VCALENDAR
> VERSION:2.0
> PRODID:-//calcurse//NONSGML v4.7.1//EN
> BEGIN:VTODO
> UID:54a610297f***3e78c095c3
> PRIORITY:1
> SUMMARY:w** *e
> END:VTODO
> END:VCALENDAR

< Status: 403 (Forbidden)
< Headers: {'cache-control': 'no-cache, no-store, max-age=0, must-revalidate', 'expires': 'Mon, 01 Jan 1990 00:00:00 GMT', 'content-type': 'text/xml; charset=UTF-8', 'pragma': 'no-cache', 'date': 'Wed, 17 Nov 2021 20:11:09 GMT', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', 'x-xss-protection': '0', 'x-frame-options': 'SAMEORIGIN', 'x-content-type-options': 'nosniff', 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'transfer-encoding': 'chunked', 'status': '403', 'content-length': '65', '-content-encoding': 'gzip'}
< <?xml version="1.0" encoding="UTF-8"?>
< <D:error xmlns:D="DAV:"/>

error: The server at apidata.googleusercontent.com replied with HTTP status code
error: 403 (Forbidden) while trying to access https://apidata.googleusercontent.
error: com/caldav/v2/***@gmail.com/events/54a610297***4a6c143c7d
error: d3e78c095c3.ics.

itzjustalan avatar Nov 17 '21 20:11 itzjustalan

it specifically says google calender only supports the cal option for SyncFilter in the sample config provided with the source code so I guess google tasks integration is out of question? if so any suggestion to get it up and running? my love for calcurse simply isnt ready for this cruel ending bit dramatic maybe yes but if someone can confirm ill have to look into doing it myself maybe another python script specifically for the google tsks things should work fine till i ditch google entirely atleast..

Set this option to "cal" if the configured CalDAV server doesn't support tasks, such as is the case with Google Calendar. SyncFilter = cal

itzjustalan avatar Nov 18 '21 13:11 itzjustalan

@itzjustalan it's a bit late but have a look at taskstodo if you are still interested in syncing calcurse with Google Tasks.

I'm the author and I'm looking for testers. It has worked fine for me for a while now but I still recommend backing up your data just in case.

stephan49 avatar Feb 19 '23 03:02 stephan49