Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I fix CookieConsent-legacy name? #73

Closed
ajmalafif opened this issue Jun 18, 2020 · 2 comments
Closed

How do I fix CookieConsent-legacy name? #73

ajmalafif opened this issue Jun 18, 2020 · 2 comments

Comments

@ajmalafif
Copy link

I didn‘t update my codebase at all except for dependabot PRs. I‘m noticing either my renamed CookieConsent or default have -legacy appended to it.

I am not sure how to resolve this and right now I‘m resorting to to have CookieConsent-legacy in my code. What is the context that triggers this legacy appended in the name?

Thank you! will share a tutorial for beginners like myself once I resolve this.

@Mastermindzh
Copy link
Owner

The short story is that some browsers don't support the SameSite=None attribute.
The modern browsers force you to have SameSite set to something other than none...

So react-cookie-consent fixes this like so:

  • set the fallback cookie (e.g -legacy) first, this will always succeed (on both browsers
  • set the correct cookie second (this will work on modern browsers, fail on older ones

This happens on lines 186-192

When checking the cookie it'll do it in reverse. If the regular cookie exists, it'll use that. If no regular cookie exists it'll check whether the legacy cookie exists. If both don't exist no consent was given.

This happens on lines 200-2010

The long story can be found here: pull-request#68

@ajmalafif
Copy link
Author

Thanks for the context @Mastermindzh

Mine is a personal site so changing the setting to SameSite="strict" fixed it. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants