feat: add BACKEND_URL configuration for OAuth redirect

- Introduced BACKEND_URL in the configuration to allow overriding the HTTP to HTTPS in the OAuth redirect URI.
- Updated the Google OAuth router to conditionally use the BACKEND_URL for the redirect URI when specified.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-10-30 23:52:14 -07:00
parent a2fb9faad6
commit a0f9c3aad8
2 changed files with 10 additions and 0 deletions

View file

@ -68,6 +68,14 @@ if config.AUTH_TYPE == "GOOGLE":
app.include_router(
fastapi_users.get_oauth_router(
google_oauth_client, auth_backend, SECRET, is_verified_by_default=True
)
if not config.BACKEND_URL
else fastapi_users.get_oauth_router(
google_oauth_client,
auth_backend,
SECRET,
is_verified_by_default=True,
redirect_url=f"{config.BACKEND_URL}/auth/google/callback",
),
prefix="/auth/google",
tags=["auth"],