question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cookie not being set in Chrome versions > 80 with ngx-cookie-service 2.4.0

See original GitHub issue

Expected Behavior

Using ngx-cookie-service 2.4.0, when a cookie is being set with key, value, Chrome browser should set the cookies in all browsers. this.cookieService.set(‘runOffline’, ‘true’);

Actual Behavior

No cookie is being set in the chrome browsers with version > 80(the latest version).

Reason

For some reason there are other libraries that are creating cookies and the cookies found in document.cookie does not start with a space. So setting a cookie in this condition does not actually set the cookie.

Steps to Reproduce the Problem

Just download the latest version of chrome and set the cookie

Specifications

  • Version: 2.4.0
  • Browser: Chrome Version 80.0.3987.132
  • OS: Ubuntu 18.04

Steps to Reproduce the Problem

Set the cookie the traditional way by leaving a space initially eg.

document.cookie = " runOffline=true; " + document.cookie

Notice the space in the beginning for some reason works well.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:35 (12 by maintainers)

github_iconTop GitHub Comments

13reactions
marcin-piechaczekcommented, Mar 11, 2020

Version 3.0 still doesn’t work

macOS, Chrome Version 80.0.3987.132 (Official Build) (64-bit)

temporary fix: pass all arguments when setting a new cookie. this.cookieService.set(‘name’, ‘John’, null, null, null, null, null);

5reactions
Yohandahcommented, Mar 11, 2020

@stevermeister yes it should fix it.

But in the case where a cookie is set with the samesite = none (via the cookieService.set method) the secure flag always has to be set. So I don’t know if ngx-cookie-service should override the secure flag if mode is none

Doing this will result with a reject from the browser :

this._cookieService.set(
cookieName,
cookieValue,
expirationDate,
'/',
someData,
false, <- secure flag
'None' <- sameSite property
);

Doing this will work

this._cookieService.set(
cookieName,
cookieValue,
expirationDate,
'/',
someData,
true, <- secure flag
'None' <- sameSite property
);

Doing this will work

this._cookieService.set(
cookieName,
cookieValue,
expirationDate,
'/',
someData,
true, <- secure flag
'Strict' <- sameSite property
);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Latest Chrome update blocks unsecure cookies in Angular
A cookie associated with a resource at http://tradmin.novlence.com/ was set with `SameSite=None` but without `Secure`. It has been blocked, as ...
Read more >
How Your Websites and Apps Could Be Broken Right Now by ...
Ngx-cookie-service has had a known issue setting cookies on Chrome browsers, but this issue was fixed. The fix was to set cookies, making...
Read more >
Angular 8 Document.Cookie Does Not Set Cookie In Http ...
Using ngxcookieservice 2.4.0 when a cookie is being set with key ... CSDNCookie not being set in Chrome versions > 80 with ngxcookieservice...
Read more >
Open Source Used In slido-test 3.0 - Cisco
This document contains licenses and notices for open source software used in this product.
Read more >
Notice - Product documentation - NetApp
with various versions of the ONTAPSelect products. ... or entities who created the Work or if no individual or entity can be identified, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found