I want to set the secure flag in my cookie when I create it. I think I have the solution but I want to be sure in order to continue. I use the ngx-cookie-service to set my cookie.
Here is my code:
const now = new Date();
now.setHours(now.getHours() + 8);
const secureFlag = true;
this.cookieService.set('usertype', 'agent', now, '/', '/', secureFlag);
The thing is that I don't know if I have to declare the 4th and 5th parameter like that because if I don't declare them it shows error.
For example I try this:
const now = new Date();
now.setHours(now.getHours() + 8);
const secureFlag = true;
this.cookieService.set('usertype', 'agent', now, secureFlag);
and it warns me with Argument of type 'true' is not assignable to parameter of type 'string'
Do I have to use '/'
for path
and domain
parameters when I don't want to define them?