Skip to content

Commit

Permalink
use env configuration for base URL, at http only to set cookie options (
Browse files Browse the repository at this point in the history
  • Loading branch information
fisher60 authored Jun 24, 2024
1 parent b58666d commit 1a32e4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/api/abandonauth/routers/ui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from urllib.parse import urlparse

import httpx
from fastapi import APIRouter, HTTPException, Request
Expand All @@ -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)
Expand Down Expand Up @@ -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
)

Expand Down
1 change: 1 addition & 0 deletions src/api/abandonauth/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a32e4c

Please sign in to comment.