4 ms·
I wish there was a way to read all cookies of the current site and create a bookmarklet that sets them again. So I could log into GitHub and save the cookies i
by TekMol 4y ago
I wish there was a way to read all cookies of the current site and create a bookmarklet that sets them again.
So I could log into GitHub and save the cookies in a bookmarklet.
Then every time I want to use GitHub, I click the bookmarklet and it sets the cookies, so I am logged in.
I dabbled with the idea a bit, but it seems not straight forward. Maybe due to some metadata that cookies carry. They are not just key:value pairs.
For example here on HN, when I type "document.cookie" into the console, I get back an empty string.
- vgel 4y agoYou might be running into issues with session cookies and HttpOnly cookies: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#re...
- spicyjpeg 4y agoThat would not work for a number of reasons, the first one being the fact that virtually every service now uses HttpOnly cookies for session management (to make it harder for e.g. XSS injected code to steal sessions). In addition to that session cookies are usually rotated very frequently, with servers occasionally updating them even if you stay logged in; it goes without saying that if you log out and back in you will almost surely get a different session token each time.