fix(WEB): FCM 토큰 등록을 위한 is_authenticated 쿠키 추가
- HttpOnly 쿠키(access_token)는 JavaScript에서 읽을 수 없어 FCM 초기화 실패 - non-HttpOnly is_authenticated 쿠키 추가로 클라이언트에서 인증 상태 확인 가능 - login/logout/refresh/proxy 라우트에서 쿠키 설정/삭제 처리 - hasAuthToken()이 is_authenticated 쿠키 확인하도록 변경
This commit is contained in:
@@ -70,6 +70,15 @@ export async function POST(request: NextRequest) {
|
||||
'Max-Age=0', // Delete immediately
|
||||
].join('; ');
|
||||
|
||||
// ✅ is_authenticated 쿠키도 삭제 (FCM 인증 상태 플래그)
|
||||
const clearIsAuthenticated = [
|
||||
'is_authenticated=',
|
||||
...(isProduction ? ['Secure'] : []),
|
||||
'SameSite=Lax',
|
||||
'Path=/',
|
||||
'Max-Age=0',
|
||||
].join('; ');
|
||||
|
||||
console.log('✅ Logout complete - Access & Refresh tokens cleared');
|
||||
|
||||
const response = NextResponse.json(
|
||||
@@ -79,6 +88,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
response.headers.append('Set-Cookie', clearAccessToken);
|
||||
response.headers.append('Set-Cookie', clearRefreshToken);
|
||||
response.headers.append('Set-Cookie', clearIsAuthenticated);
|
||||
|
||||
return response;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user