Skip to content

Commit

Permalink
update: ログアウト時の挙動を改善
Browse files Browse the repository at this point in the history
  • Loading branch information
rkun123 authored and PigeonsHouse committed Apr 15, 2023
1 parent b74c157 commit 8604690
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion routers/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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

0 comments on commit 8604690

Please sign in to comment.