add missing scopes
This commit is contained in:
7
lib.py
7
lib.py
@@ -32,6 +32,9 @@ def get_credentials():
|
||||
Returns:
|
||||
service_account.Credentials: The loaded credentials
|
||||
"""
|
||||
# OAuth scopes required for Vertex AI API
|
||||
SCOPES = ["https://www.googleapis.com/auth/cloud-platform"]
|
||||
|
||||
# Try to load credentials from JSON content directly
|
||||
credentials_json = os.getenv("GOOGLE_CREDENTIALS_JSON")
|
||||
|
||||
@@ -43,7 +46,7 @@ def get_credentials():
|
||||
logger.info(f"creds JSON parsed: {credentials_info}")
|
||||
|
||||
return service_account.Credentials.from_service_account_info(
|
||||
credentials_info
|
||||
credentials_info, scopes=SCOPES
|
||||
)
|
||||
except json.JSONDecodeError as e:
|
||||
raise ValueError(f"Invalid JSON in GOOGLE_CREDENTIALS_JSON: {e}")
|
||||
@@ -55,7 +58,7 @@ def get_credentials():
|
||||
|
||||
if credentials_path and os.path.exists(credentials_path):
|
||||
return service_account.Credentials.from_service_account_file(
|
||||
credentials_path
|
||||
credentials_path, scopes=SCOPES
|
||||
)
|
||||
|
||||
# If neither is provided, return None to let the client use default credentials
|
||||
|
||||
Reference in New Issue
Block a user