refactored the credential checking logic into a shared helper function to reduce code duplication
This commit is contained in:
@@ -15,7 +15,7 @@ import socket
|
||||
from fastapi import FastAPI, Request
|
||||
import uvicorn
|
||||
|
||||
from auth.google_auth import handle_auth_callback, CONFIG_CLIENT_SECRETS_PATH
|
||||
from auth.google_auth import handle_auth_callback, check_client_secrets
|
||||
from auth.scopes import OAUTH_STATE_TO_SESSION_ID_MAP, SCOPES
|
||||
from auth.oauth_responses import create_error_response, create_success_response, create_server_error_response
|
||||
|
||||
@@ -60,11 +60,9 @@ class MinimalOAuthServer:
|
||||
|
||||
try:
|
||||
# Check if we have credentials available (environment variables or file)
|
||||
from auth.google_auth import load_client_secrets_from_env
|
||||
env_config = load_client_secrets_from_env()
|
||||
if not env_config and not os.path.exists(CONFIG_CLIENT_SECRETS_PATH):
|
||||
logger.error(f"OAuth client credentials not found. No environment variables set and no file at {CONFIG_CLIENT_SECRETS_PATH}")
|
||||
return create_server_error_response("OAuth client credentials not found. Please set GOOGLE_OAUTH_CLIENT_ID and GOOGLE_OAUTH_CLIENT_SECRET environment variables or provide client_secret.json file.")
|
||||
error_message = check_client_secrets()
|
||||
if error_message:
|
||||
return create_server_error_response(error_message)
|
||||
|
||||
logger.info(f"OAuth callback: Received code (state: {state}). Attempting to exchange for tokens.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user