ngx-cookie-service does not send Cookies in Angular/Ionic

436 Views Asked by At

Angular 16

Ionic 7

ngx-cookie-service 16

With this.cookieService.set('sessionkey', 'a-unique-hash', null, null, null, false, 'Lax'); or this.cookieService.set('sessionkey', 'a-unique-hash'); i set a cookie. In my browser tools can i see the cookie for the domain. But no cookie is send with request to the server.

I expect that the cookies can be seen in the browser tools under "Network" in the request (cookies send with the request).

[edit]

All requests has withCredentials: true:

req = req.clone({
  url: this.apiBaseUrl + req.url,
  withCredentials: true,
});

[edit]

If I don't clone the request with an object as a parameter, the url is wrong but the cookies are sent.

...the clone() function make the shit. Why?

1

There are 1 best solutions below

2
Torsten On

Only Google Chrome does not send the cookies. I tested it several times.

Google Chrome Version 114.0.5735.106 (Offizieller Build) (64-Bit)

With Firefox, the cookies are sent without any problems.

...both on Xubuntu 22.04.2 LTS - 5.19.0-43-generic.

[edit]

Google Chrome now in Version 114.0.5735.198 and the problem is still there. In Firefox is all OK.

[edit] It also doesn't work in the current Opera (100.0.4815.21) browser.