#!/usr/bin/env python3
"""
Google Workspace Authentication Script
Run this to authenticate with all required scopes
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from src.google_auth import get_credentials, SCOPES
print("=" * 60)
print("Google Workspace Authentication")
print("=" * 60)
print("\nRequired scopes:")
for scope in SCOPES:
print(f" - {scope.split('/')[-1]}")
print("\nA browser window will open for authentication.")
print("Please sign in with your Google account and grant all permissions.\n")
try:
creds = get_credentials()
print("\n" + "=" * 60)
print("Authentication successful!")
print("=" * 60)
print("\nYou can now use all Google Workspace tools:")
print(" - Gmail (read, send, drafts, labels)")
print(" - Calendar (events)")
print(" - Sheets (create, read, write, format)")
print(" - Docs (create, read, write, format)")
print(" - Drive (files, folders, sharing)")
except Exception as e:
print(f"\nAuthentication failed: {e}")
sys.exit(1)