0

Working on some cookie removal issues. There are some cookies coming from Twitter and I cannot seem to get them to delete. In my code, I am adding in the correct path and domain to the remove code.

This is what is getting called

Cookies.remove(names[idx][0], {path: '/', domain: names[idx][1]});

Which, for this specific cookie, would look like this

Cookies.remove('correct_cookie_name_here', {path: '/', domain: '.twitter.com'});

But the cookie will not go away. It has a value of 0, but if I try to set it to -1 to expire or null its value it does not go away either. I did notice that it has a checkmark in the Secure column but couldn't find anything about that. Otherwise, I am not sure why this won't go away. This code does work for most of the cookies I am encountering so there is something with this cookie specifically that it will not go away.

Rockwell Rice
  • 3,376
  • 5
  • 33
  • 61
  • Well you can not remove cookies on other domains. What are you trying to achieve by removing Twitter cookie though? – Shiham Jun 16 '20 at 15:07
  • Worth checking this https://stackoverflow.com/questions/3342140/cross-domain-cookies – Shiham Jun 16 '20 at 15:09
  • @Shiham we are being asked to remove all cookies if consent is taken away. The twitter cookie is getting set on the page, I guess I will have to look at where it is coming from and maybe just remove the source of it? Are you saying that, if the domain value is different than the current domain I cannot remove the cookie? Thanks for the link – Rockwell Rice Jun 16 '20 at 15:10
  • remove all cookies -> means removing all the cookies set by your domain. If you want to remove cookies set by Twitter, you should be removing the Twitter component which set the domain since you dont have direct control over the cookie. Hope it helps. – Shiham Jun 16 '20 at 15:15
  • Ok thanks for clearing that up, I was a little confused about how this worked – Rockwell Rice Jun 16 '20 at 15:21

0 Answers0