Access Token 저장 방식 변경

This commit is contained in:
static
2024-12-28 16:54:46 +09:00
parent 1d0c309878
commit c09a0b4aa0
10 changed files with 44 additions and 83 deletions

View File

@@ -4,8 +4,11 @@ import type { RequestHandler } from "./$types";
export const POST: RequestHandler = async ({ cookies }) => {
const token = cookies.get("refreshToken");
if (!token) error(401, "Token not found");
if (!token) error(401, "Refresh token not found");
await logout(token.trim());
return text("Logged out");
cookies.delete("accessToken", { path: "/" });
cookies.delete("refreshToken", { path: "/api/auth" });
return text("Logged out", { headers: { "Content-Type": "text/plain" } });
};