INNER CODE UNIT · Python
_clear_auth_cookie_header
hunvreus/devpush · app/dependencies.py:218
def _clear_auth_cookie_header(settings: Settings) -> str:
secure = "Secure; " if settings.url_scheme == "https" else ""
return f"auth_token=; Path=/; Max-Age=0; HttpOnly; SameSite=Lax; {secure}"
def _refresh_auth_token(
request: Request,
settings: Settings,
user_id: int,
expires_at: datetime,
):
if settings.auth_token_refresh_threshold_days <= 0:
return
refresh_threshold = timedelta(days=settings.auth_token_refresh_threshold_days)
if expires_at - utc_now() > refresh_threshold:
return
now = utc_now()
new_exp = now + timedelta(days=settings.auth_token_ttl_days)