To simplify the OAuth authentication and terminate reliance on pickle module to make the code more redundant while retaining the core functionality.
Details
3094
The latest code features the following code to handle authentication:
`def _auth():
creds = None
if os.path.exists("token.json"):
creds = Credentials.from_authorized_user_file("token.json", SCOPES)
If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
"credentials.json", SCOPES
)
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open("token.json", "w") as token:
token.write(creds.to_json())
service = build("calendar", "v3", credentials=creds)
return service`
To reduce notifications, issues are locked. Your issue will be unlocked when we add the label gssoc23. If you're participating in GSSoC'23, please add the gssoc23 label to your issue.
Aim
To simplify the OAuth authentication and terminate reliance on pickle module to make the code more redundant while retaining the core functionality.
Details
3094
The latest code features the following code to handle authentication: `def _auth(): creds = None if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES)
If there are no (valid) credentials available, let the user log in.
A global variable 'SCOPES' is used to define "https://www.googleapis.com/auth/calendar".
Record