diff --git a/backend/google_contacts.py b/backend/google_contacts.py index 43671ae..7dbc129 100644 --- a/backend/google_contacts.py +++ b/backend/google_contacts.py @@ -1,4 +1,6 @@ import httpx +import ssl +import certifi from sqlalchemy.orm import Session from uuid import UUID import models @@ -86,7 +88,8 @@ async def import_contacts_from_google( imported_count = 0 - async with httpx.AsyncClient() as client: + ssl_ctx = ssl.create_default_context(cafile=certifi.where()) + async with httpx.AsyncClient(verify=ssl_ctx) as client: response = await client.get(url, headers=headers, params=params) logger.info(f"Google API response status: {response.status_code}") diff --git a/backend/main.py b/backend/main.py index f5f3dd4..3fd9d81 100644 --- a/backend/main.py +++ b/backend/main.py @@ -17,6 +17,8 @@ import shutil from pathlib import Path from dotenv import load_dotenv import httpx +import ssl +import certifi from urllib.parse import urlencode, quote from datetime import timezone, timedelta @@ -1077,7 +1079,8 @@ async def google_callback( raise HTTPException(status_code=500, detail="Google OAuth credentials not configured") try: - async with httpx.AsyncClient() as client_http: + ssl_ctx = ssl.create_default_context(cafile=certifi.where()) + async with httpx.AsyncClient(verify=ssl_ctx) as client_http: # Exchange authorization code for access token token_url = "https://oauth2.googleapis.com/token"