gcalcli
gcalcli copied to clipboard
I have renew the token every 7 days
Every 7 days, I start getting the following error in my log files
Traceback (most recent call last):
File "/usr/bin/gcalcli", line 11, in <module>
load_entry_point('gcalcli==4.3.0', 'console_scripts', 'gcalcli')()
File "/usr/lib/python3/dist-packages/gcalcli/cli.py", line 152, in main
gcal.AgendaQuery(start=parsed_args.start, end=parsed_args.end)
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 1238, in AgendaQuery
return self._display_queried_events(start, end)
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 1182, in _display_queried_events
event_list = self._search_for_events(start, end, search)
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 1130, in _search_for_events
self.get_cal_service()
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 158, in get_cal_service
http=self._google_auth())
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 139, in _google_auth
credentials = tools.run_flow(
File "/usr/lib/python3/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/lib/python3/dist-packages/oauth2client/tools.py", line 240, in run_flow
code = input('Enter verification code: ').strip()
EOFError: EOF when reading a line
sending next hour reminders
getting next day events
Traceback (most recent call last):
File "/usr/bin/gcalcli", line 11, in <module>
load_entry_point('gcalcli==4.3.0', 'console_scripts', 'gcalcli')()
File "/usr/lib/python3/dist-packages/gcalcli/cli.py", line 152, in main
gcal.AgendaQuery(start=parsed_args.start, end=parsed_args.end)
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 1238, in AgendaQuery
return self._display_queried_events(start, end)
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 1182, in _display_queried_events
event_list = self._search_for_events(start, end, search)
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 1130, in _search_for_events
self.get_cal_service()
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 158, in get_cal_service
http=self._google_auth())
File "/usr/lib/python3/dist-packages/gcalcli/gcal.py", line 139, in _google_auth
credentials = tools.run_flow(
File "/usr/lib/python3/dist-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/lib/python3/dist-packages/oauth2client/tools.py", line 240, in run_flow
code = input('Enter verification code: ').strip()
Basically the error is code = input('Enter verification code: ').strip()
To fix it, I have to create a new OAuth2 token and run this command again
gcalcli --noauth_local_webserver --client-id=$clientid --client-secret=$clientsecret --config-folder $parentdir/clients/$clientdir/auth agenda
And then it lasts for 7 more days, and I have to repeat the process again.
What I'm I doing wrong here?
This is the actual error
oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Token has been expired or revoked.
For some reason the token expired
I have the same issue:
In documentation https://developers.google.com/identity/protocols/oauth2#expiration there is written:
A Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of "Testing" is issued a refresh token expiring in 7 days.
So the app needs to be published, which required google verification. :-(
I have not found a solution yet.
Duplicate of https://github.com/insanum/gcalcli/issues/611 ?
@aristosv @dequeckerp
You guys can try this work around:

If you are using KDE, add that url to kOrganizer, restart your system. Then use konsolekalendar in terminal.
I don't see how that iCal link can be used with gcalcli command line options.
Per https://github.com/insanum/gcalcli/issues/611 , if we can figure out how to get gcalcli to pass a redirect_uri parameter to the Python Google OAuth2 module, it should be possible to publish the app without Google review and have longer-lasting tokens. I also filed an Ubuntu bug report at https://bugs.launchpad.net/ubuntu/+source/python-oauth2client/+bug/1983216 since it appears upstream is no longer maintaining the relevant library https://github.com/googleapis/oauth2client/issues/317
Does the replacement library google-auth support the required functionality?
I believe so. The deprecated Python module doesn't allow the code to specify redirect_uri. If we want to publish a web app in production rather than testing (thus extending the token expiration period), while foregoing Google verification, we need to be able to set redirect_uri. There's probably some way to hack around this in the existing gcalcli code but it wasn't something I could solve in a few minutes.
I've published my own google app I was using to connect and I haven't had issues since. It gave an ugly warning about not being verified when logging in, but you can say you don't care :)
I've published my own google app I was using to connect and I haven't had issues since. It gave an ugly warning about not being verified when logging in, but you can say you don't care :)
How did you publish it? Doesn't it need to pass a manual review by Google?
On Sun Apr 16, 2023 at 14:55, Feraidoon Mehri wrote:
I've published my own google app I was using to connect and I haven't had issues since. It gave an ugly warning about not being verified when logging in, but you can say you don't care :)
How did you publish it? Doesn't it need to pass a manual review by Google?
No, it doesn't, unless you want to make that warning go away.