fix: persist refresh cookie across browser restarts (WealthLedger/backend#123)

The refresh cookie had no Max-Age, so browsers dropped it on close
while the Session stayed valid for 7 days. Set maxAge from
REFRESH_TTL_MS, the same constant behind Session.expiresAt.
This commit is contained in:
2026-10-23 08:15:41 +03:00
parent b20080ac85
commit 4ae2db225d
3 changed files with 15 additions and 7 deletions
@@ -22,7 +22,7 @@ import {
import { ApiProblemResponses } from '../../../common/decorators/api-safe-error-response.decorator';
import { HttpErrorCode } from '../../../common/error-code';
import { AuthService } from '../application/auth.service';
import { AuthService, REFRESH_TTL_MS } from '../application/auth.service';
import { AccessPayload, AuthenticationResult } from '../application/auth.types';
import { LoginDto, RegisterDto } from './auth.dto';
import { JwtAuthGuard } from './jwt-auth.guard';
@@ -134,6 +134,7 @@ export class AuthController {
sameSite: 'lax' as const,
secure: process.env['NODE_ENV'] !== 'development',
path: COOKIE_PATH,
maxAge: REFRESH_TTL_MS,
};
}
}