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:
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user