diff --git a/src/api/abandonauth/routers/ui.py b/src/api/abandonauth/routers/ui.py index 752571f..2b8c14d 100644 --- a/src/api/abandonauth/routers/ui.py +++ b/src/api/abandonauth/routers/ui.py @@ -1,4 +1,3 @@ -from urllib.parse import urlparse import httpx from fastapi import APIRouter, HTTPException, Request @@ -13,10 +12,7 @@ router = APIRouter(prefix="/ui") -BASE_URL = "http://localhost:8000" - - -COOKIE_DOMAIN_URL = "." + ".".join(urlparse(settings.ABANDON_AUTH_SITE_URL).netloc.split(".")[-2:]) +BASE_URL = settings.ABANDON_AUTH_URL @router.get("/", include_in_schema=False) @@ -61,7 +57,7 @@ async def index(request: Request, code: str | None = None) -> RedirectResponse: resp.set_cookie( key="Authorization", value=token, # pyright: ignore [reportArgumentType] - domain=COOKIE_DOMAIN_URL, + httponly=True, secure=True ) diff --git a/src/api/abandonauth/settings.py b/src/api/abandonauth/settings.py index b9646ff..769d445 100644 --- a/src/api/abandonauth/settings.py +++ b/src/api/abandonauth/settings.py @@ -15,6 +15,7 @@ class Settings(BaseSettings): ABANDON_AUTH_DEVELOPER_APP_ID: str ABANDON_AUTH_DEVELOPER_APP_TOKEN: str ABANDON_AUTH_SITE_URL: str + ABANDON_AUTH_URL: str DISCORD_REDIRECT: str ABANDON_AUTH_DISCORD_CALLBACK: str