Deleting cookies: All paths & domains
See original GitHub issueWhe I try to delete a cookie by simple delete method, it does not work. I think it requires to the path & domain also.
this.cookieService.delete("auth_token");
thus, I need to write:
this.cookieService.delete("auth_token", "/", "quizcv.com");
this.cookieService.delete("auth_token", "/", "www.quizcv.com");
this.cookieService.delete("auth_token", "/", "localhost");
which is very uncomfortable. Moreover, there are some combinations with different paths.
How can I delete all cookies, whatever the path or domain is?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
java - how to delete all cookies of different path under a domain
getCookies(); gets all the Cookies that are sent by the browser to the Server. Check if the cookies you expect are getting returned,...
Read more >cookies.remove() - Mozilla - MDN Web Docs
The remove() method of the cookies API deletes a cookie, given its name and URL. The call succeeds only if you include the...
Read more >setcookie - Manual - PHP
The path on the server in which the cookie will be available on. ... If you want to delete all cookies on your...
Read more >JavaScript Cookies - w3resource
For each domain and path, you can store upto 20 cookies. ... If a page www.w3resource.com/javascript/ sets a cookie then all the pages...
Read more >Unable to delete cookie "_mkto_trk" from parent domain
document.cookie = "_mkto_trk=; path=/; domain=.example.com;expires=Thu, ... example.com and all subdomains — you could delete it either with
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No need to add domain it worked for me like this… this.cookieService.delete(‘myCookie’, ’ / ');
The browser (and therefore the cookie-service) simply just have no way of knowing the paths and domains of the set cookies. For security reasons, they can only access the cookies of the current path and domain.
Here you can find a good explanation of the issue:
The only thing you can do is to take an educated guess, like in this attempt.