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:
@@ -79,6 +79,15 @@ function createTokenCookies(tokens: { accessToken?: string; refreshToken?: strin
|
||||
'Path=/',
|
||||
`Max-Age=${tokens.expiresIn || 7200}`,
|
||||
].join('; '));
|
||||
|
||||
// ✅ FCM 등에서 인증 상태 확인용 (non-HttpOnly)
|
||||
cookies.push([
|
||||
'is_authenticated=true',
|
||||
...(isProduction ? ['Secure'] : []),
|
||||
'SameSite=Lax',
|
||||
'Path=/',
|
||||
`Max-Age=${tokens.expiresIn || 7200}`,
|
||||
].join('; '));
|
||||
}
|
||||
|
||||
if (tokens.refreshToken) {
|
||||
@@ -104,6 +113,7 @@ function createClearTokenCookies(): string[] {
|
||||
return [
|
||||
`access_token=; HttpOnly${secureFlag}; SameSite=Lax; Path=/; Max-Age=0`,
|
||||
`refresh_token=; HttpOnly${secureFlag}; SameSite=Lax; Path=/; Max-Age=0`,
|
||||
`is_authenticated=${secureFlag}; SameSite=Lax; Path=/; Max-Age=0`,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user