261102_02_ENH: 공용 인증 쿠키 도메인 적용 조건 수정 및 외부 링크 인증 탭별 분리

This commit is contained in:
2026-11-02 15:55:25 +09:00
parent 69939f8d2b
commit cbd0a559e9
24 changed files with 187 additions and 114 deletions

View File

@@ -7,9 +7,7 @@ import { CookieKeys } from "@/store/cookie/cookie-keys";
/** Issue/renew the normal-login cookie, or expire it when the token is empty. */
export function setAuthCookie(response: NextResponse, token: string): void {
const production = serverEnv.ENV === "prod";
const domain = production ? serverEnv.AUTH_COOKIE_DOMAIN : undefined;
if (production && !domain)
throw new Error("AUTH_COOKIE_DOMAIN must be configured when ENV is prod.");
const domain = serverEnv.AUTH_COOKIE_DOMAIN;
const options = {
httpOnly: true,
@@ -30,6 +28,6 @@ export function setAuthCookie(response: NextResponse, token: string): void {
response.headers.append("Set-Cookie", header);
};
if (production) append("", undefined, 0);
if (domain) append("", undefined, 0);
append(token, domain, token ? AUTH_COOKIE_MAX_AGE : 0);
}