Fix google auth url backend now

This commit is contained in:
dvirlabs 2025-12-31 02:04:59 +02:00
parent 2c5668d21e
commit 40f264a08a

View File

@ -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
)