🔒 Update COOKIE_OPTIONS to handle secure cookies based on environment (localhost vs production).

master
Alix JEUDI--LEMOINE 2 days ago
parent 53ce0dc21f
commit cf4aff473c

@ -11,12 +11,19 @@ export class CookiesService {
private readonly USERNAME_KEY = 'username';
private readonly USER_ID = 'userId';
private readonly IS_ADMIN_KEY = 'isAdmin';
private readonly COOKIE_OPTIONS = {
private get COOKIE_OPTIONS() {
const isLocalhost = window.location.hostname === 'localhost' ||
window.location.hostname === '127.0.0.1' ||
window.location.hostname.includes('localhost');
return {
path: '/',
domain: window.location.hostname,
secure: true,
secure: !isLocalhost,
sameSite: 'Strict' as const,
};
}
constructor(
private router: Router,

Loading…
Cancel
Save