Skip to content

Commit b5eb45a

Browse files
committed
update: ログアウト時の挙動を改善
1 parent efb1e10 commit b5eb45a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

routers/auth/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from fastapi import APIRouter
88
from fastapi.security import OAuth2PasswordBearer
99
from utils.discord import discord_exchange_code
10+
from datetime import datetime
1011

1112
FRONTEND_HOST_URL = os.environ.get("FRONTEND_HOST_URL")
1213
CLIENT_ID = os.environ.get("DISCORD_CLIENT_ID")
@@ -39,5 +40,6 @@ async def discord_callback(code: str = "", db: Session = Depends(get_db)):
3940
@auth_router.post("/logout")
4041
async def logout():
4142
response = Response()
42-
response.set_cookie(AUTH_COOKIE_KEY, "")
43+
# 有効期限として現在のtimestampを設定することでCookieを削除する
44+
response.set_cookie(AUTH_COOKIE_KEY, "", expires=datetime.now().timestamp())
4345
return response

0 commit comments

Comments
 (0)