From b5eb45acd813d2c3e8f5f06a50993882a89d5863 Mon Sep 17 00:00:00 2001 From: rkun Date: Tue, 29 Nov 2022 01:58:43 +0900 Subject: [PATCH] =?UTF-8?q?update:=20=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E6=99=82=E3=81=AE=E6=8C=99=E5=8B=95=E3=82=92=E6=94=B9?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/auth/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/routers/auth/__init__.py b/routers/auth/__init__.py index 351bcf7..97f8f41 100644 --- a/routers/auth/__init__.py +++ b/routers/auth/__init__.py @@ -7,6 +7,7 @@ from fastapi import APIRouter from fastapi.security import OAuth2PasswordBearer from utils.discord import discord_exchange_code +from datetime import datetime FRONTEND_HOST_URL = os.environ.get("FRONTEND_HOST_URL") CLIENT_ID = os.environ.get("DISCORD_CLIENT_ID") @@ -39,5 +40,6 @@ async def discord_callback(code: str = "", db: Session = Depends(get_db)): @auth_router.post("/logout") async def logout(): response = Response() - response.set_cookie(AUTH_COOKIE_KEY, "") + # 有効期限として現在のtimestampを設定することでCookieを削除する + response.set_cookie(AUTH_COOKIE_KEY, "", expires=datetime.now().timestamp()) return response