gcalcli icon indicating copy to clipboard operation
gcalcli copied to clipboard

Google limits access to 7 days.

Open jsellin78 opened this issue 3 years ago • 9 comments

So every week i have to do the process over agen to get access to my calender. Google limits token for 7 days, then you have to do it all over agen witch is frustrating.

I've googled about this issue, and no one seems to know anything about it.

why cant i have permanent access to my calender with gcalcli without having to reauthenticate every week?

jsellin78 avatar Jul 25 '22 18:07 jsellin78

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

ajkessel avatar Jul 31 '22 19:07 ajkessel

For what it's worth, here is a fork where the deprecated oauth2client library has been replaced with google-auth. I just threw this at the problem.

I'm refraining from making it a PR for now, as it is untested, redirect_uri is hardcoded to localhost (which I don't like, and I'm not even sure if it is needed). This still doesn't fully solve the 7-day expiration issue, but hopefully paves the way to try the redirect_uri approach.

Nephiel avatar Apr 09 '23 17:04 Nephiel

Went with this instead. Basically what it does it sleep every second and checks if the typed date matches current date. whats nice about it is that it runs as a daemon in the backround, with very little cpu usage :)

to run

python3 timer.py 2023 04 09 19 25

#! /usr/bin/env python3

import time import os import sys from datetime import date import subprocess import datetime import threading import requests

chat_id= #Enter Telegramchat_id TOKEN= #Token

def start_timer(): year = int(sys.argv[1]) month = int(sys.argv[2]) day = int(sys.argv[3]) hour = int(sys.argv[4]) minute = int(sys.argv[5]) description = str(sys.argv[6]) #Currency des2 = str(sys.argv[7]) #16x or 19x or 23x date1 = str(sys.argv[8]) #date when occured startTime = datetime.datetime(year, month, day, hour, minute) print (" ~~> Telegram Alert is set for:{}".format(startTime)) while datetime.datetime.now() < startTime: time.sleep(1) print('Time's up') url = f" https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={chat_id}&text={description} " print(requests.get(url).json())

myTimerThread=threading.Thread( target=start_timer, name='myTimerThread') myTimerThread.daemon = True myTimerThread.start() myTimerThread.join()

On Sun, Apr 9, 2023 at 7:32 PM Nephiel @.***> wrote:

For what it's worth, here is a fork https://github.com/Nephiel/gcalcli where the deprecated oauth2client library has been replaced with google-auth. I just threw this https://stackoverflow.com/a/52101480 at the problem.

I'm refraining from making it a PR for now, as it is untested, redirect_uri is hardcoded to localhost (which I don't like, and I'm not even sure if it is needed). This still doesn't fully solve the 7-day expiration issue, but hopefully paves the way to try the redirect_uri approach.

— Reply to this email directly, view it on GitHub https://github.com/insanum/gcalcli/issues/634#issuecomment-1501177007, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIGQDF5LHB5T6EMTM7UMUOLXALXDLANCNFSM54TFBINQ . You are receiving this because you authored the thread.Message ID: @.***>

jsellin78 avatar Apr 09 '23 17:04 jsellin78