chore: auto-commit from dashboard
This commit is contained in:
@@ -6,7 +6,7 @@ Run this once to generate token.json for calendar access.
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from google_auth_oauthlib.flow import Flow
|
||||
from google_auth_oauthlib.flow import InstalledAppFlow
|
||||
from google.auth.transport.requests import Request
|
||||
from google.oauth2.credentials import Credentials
|
||||
|
||||
@@ -32,26 +32,11 @@ def main():
|
||||
print(f"Starting OAuth flow...")
|
||||
print(f"Using credentials: {CREDENTIALS_FILE}\n")
|
||||
|
||||
flow = Flow.from_client_secrets_file(
|
||||
flow = InstalledAppFlow.from_client_secrets_file(
|
||||
str(CREDENTIALS_FILE),
|
||||
scopes=SCOPES,
|
||||
redirect_uri='urn:ietf:wg:oauth:2.0:oob'
|
||||
scopes=SCOPES
|
||||
)
|
||||
|
||||
auth_url, _ = flow.authorization_url(prompt='consent')
|
||||
|
||||
print("="*60)
|
||||
print("AUTHORIZATION REQUIRED")
|
||||
print("="*60)
|
||||
print("\n1. Open this URL in your browser:\n")
|
||||
print(auth_url)
|
||||
print("\n2. Sign in and authorize access")
|
||||
print("3. Copy the authorization code and paste it below\n")
|
||||
|
||||
code = input("Enter authorization code: ").strip()
|
||||
|
||||
flow.fetch_token(code=code)
|
||||
creds = flow.credentials
|
||||
creds = flow.run_local_server(port=0, open_browser=False)
|
||||
|
||||
# Save the credentials for next run
|
||||
TOKEN_FILE.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user