From 40f264a08a8540f044dc3c69ba76c7b2cc74425a Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Wed, 31 Dec 2025 02:04:59 +0200 Subject: [PATCH] Fix google auth url backend now --- backend/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/main.py b/backend/main.py index 1e2735a..e30919f 100644 --- a/backend/main.py +++ b/backend/main.py @@ -113,7 +113,8 @@ def search_guests( # Google OAuth configuration GOOGLE_CLIENT_ID = os.getenv("GOOGLE_CLIENT_ID") GOOGLE_CLIENT_SECRET = os.getenv("GOOGLE_CLIENT_SECRET") -GOOGLE_REDIRECT_URI = "http://localhost:8000/auth/google/callback" +GOOGLE_REDIRECT_URI = os.getenv("GOOGLE_REDIRECT_URI", "http://localhost:8000/auth/google/callback") +FRONTEND_URL = os.getenv("FRONTEND_URL", "http://localhost:5173") # Google OAuth endpoints @app.get("/auth/google") @@ -179,13 +180,13 @@ async def google_callback(code: str, db: Session = Depends(get_db)): # Redirect back to frontend with success message return RedirectResponse( - url=f"http://localhost:5173?imported={imported_count}&owner={owner}", + url=f"{FRONTEND_URL}?imported={imported_count}&owner={owner}", status_code=302 ) except Exception as e: # Redirect back with error return RedirectResponse( - url=f"http://localhost:5173?error={str(e)}", + url=f"{FRONTEND_URL}?error={str(e)}", status_code=302 )