Da-123 commited on
Commit
b09e6c1
Β·
1 Parent(s): dbfe46f

google auth

Browse files
Files changed (1) hide show
  1. agentic_implementation/setup_oauth.py +14 -25
agentic_implementation/setup_oauth.py CHANGED
@@ -11,6 +11,10 @@ import json
11
  from pathlib import Path
12
  from oauth_manager import oauth_manager
13
  from logger import logger
 
 
 
 
14
 
15
  def print_banner():
16
  """Print setup banner"""
@@ -78,31 +82,16 @@ def setup_oauth_credentials():
78
  """Guide user through OAuth credentials setup"""
79
  print_step(3, "OAuth Client Credentials Setup")
80
 
81
- print("Now you need to create OAuth 2.0 client credentials.")
82
- print("\nπŸ“‹ Follow these steps:")
83
- print("1. Go to: https://console.cloud.google.com/apis/credentials")
84
- print("2. Click 'Create Credentials' > 'OAuth client ID'")
85
- print("3. Choose 'Web application' as the application type")
86
- print("4. Set the name to 'Gmail MCP Server'")
87
- print("5. Add this redirect URI:")
88
- print(" http://localhost:8080/oauth2callback")
89
- print("6. Click 'Create'")
90
- print("7. Copy the Client ID and Client Secret")
91
-
92
- print("\nπŸ”‘ Enter your OAuth credentials:")
93
-
94
- while True:
95
- client_id = input("Client ID: ").strip()
96
- if client_id:
97
- break
98
- print("❌ Client ID cannot be empty")
99
-
100
- while True:
101
- client_secret = input("Client Secret: ").strip()
102
- if client_secret:
103
- break
104
- print("❌ Client Secret cannot be empty")
105
-
106
  try:
107
  oauth_manager.setup_client_secrets(client_id, client_secret)
108
  print("βœ… OAuth credentials saved successfully")
 
11
  from pathlib import Path
12
  from oauth_manager import oauth_manager
13
  from logger import logger
14
+ from dotenv import load_dotenv
15
+ load_dotenv()
16
+ import os
17
+
18
 
19
  def print_banner():
20
  """Print setup banner"""
 
82
  """Guide user through OAuth credentials setup"""
83
  print_step(3, "OAuth Client Credentials Setup")
84
 
85
+ client_id = os.getenv("GOOGLE_CLIENT_ID")
86
+ client_secret = os.getenv("GOOGLE_CLIENT_SECRET")
87
+
88
+ if not client_id or not client_secret:
89
+ print("❌ Missing GOOGLE_CLIENT_ID or GOOGLE_CLIENT_SECRET in your .env")
90
+ print(" Please add:")
91
+ print(" GOOGLE_CLIENT_ID=your-client-id")
92
+ print(" GOOGLE_CLIENT_SECRET=your-client-secret")
93
+ return False
94
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  try:
96
  oauth_manager.setup_client_secrets(client_id, client_secret)
97
  print("βœ… OAuth credentials saved successfully")