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

GM_Cookie #603

Closed
qsniyg opened this issue Sep 4, 2019 · 6 comments
Closed

GM_Cookie #603

qsniyg opened this issue Sep 4, 2019 · 6 comments
Labels
enhancement external interoperability interoperability of userscript engines, a difference in behavior

Comments

@qsniyg
Copy link
Contributor

qsniyg commented Sep 4, 2019

Implementation of Tampermonkey/tampermonkey#465 and greasemonkey/greasemonkey#1802 . This would be very useful for my userscript, as it requires a few API calls that need cookies from the websites to access otherwise private user data (original images for Flickr etc.). document.cookie does not contain server-side cookies, which are needed for this unfortunately.

@tophf
Copy link
Member

tophf commented Jan 28, 2020

GM_Cookie is not supported by other userscript managers (TM only has it in beta) so we won't implement it either. Violentmonkey now exposes protected HTTP headers to GM_xmlHttpRequest event handlers so it should be possible to read all of the cookies from Set-Cookie header inside response.responseHeaders multi-line string.

We will implement it once it's out of beta in Tampermonkey and actually works in its stable release.

@tophf tophf closed this as completed Jan 28, 2020
@tophf tophf added the wontfix label Jan 28, 2020
@qsniyg
Copy link
Contributor Author

qsniyg commented Apr 15, 2020

Would it be possible to reconsider this feature? There are so many cases now where I've been unable to support websites because of lack of GM_Cookie support in VM (e.g. due to CSRF protection, requiring a header to match a cookie). Set-Cookie is only helpful if the web server returns it consistently, which unfortunately is rarely the case. If I were to try to force it to return the Set-Cookie header by removing a field from the Cookie header, it will overwrite the user's cookies, resulting in the user possibly being logged out. Yes it's annoying and (imo) stupid on the part of the server, but unfortunately there's no way I can see to go around this limitation.

I should also add that even when document.cookie does contain the required cookie (which is rare, as it somewhat defeats the purpose), it only works when you're on the page itself, which means that API calls are out of the question (e.g. browsing a photo hosted on a website that requires an API call, from a different website)

@Neurotoxin001

This comment has been minimized.

@tophf
Copy link
Member

tophf commented Jul 16, 2020

No. I've just debugged Tampermonkey stable and it does not actually implement GM_cookie. All it has is a dummy function that always returns an undefined result and not supported in the second parameter (this is the error). Try asking the userscript author to use a dummy polyfill so that their script will be able to run in more engines even if it's not in fully functional mode.

We will implement it once it's out of beta in Tampermonkey and actually works in its stable release.

@violentmonkey violentmonkey locked as off-topic and limited conversation to collaborators Jul 16, 2020
@violentmonkey violentmonkey deleted a comment from Neurotoxin001 Jul 16, 2020
@violentmonkey violentmonkey unlocked this conversation Jan 9, 2023
@JenieX
Copy link

JenieX commented Jan 9, 2023

I'm thinking of creating an npm package, something similar to this instagram-stories.

Similar packages and scrappers usually require credentials (cookies). Most user scripts developers would go through the trouble of creating a tutorial on how to extract the required credentials, see this developer. That is why I think it would be a good idea for me to create a user script that exports the required credentials to a file that later can be used with my npm package.

@KaKi87
Copy link

KaKi87 commented Apr 13, 2023

Hello @tophf & @gera2ld, I encountered an issue that only this API can solve, please consider implementing it.

I reported this at 3 different places, choose where to read it from :

Thanks

@violentmonkey violentmonkey locked as off-topic and limited conversation to collaborators Jul 15, 2023
@violentmonkey violentmonkey deleted a comment from KaKi87 Jul 15, 2023
@violentmonkey violentmonkey unlocked this conversation Jul 15, 2023
@violentmonkey violentmonkey deleted a comment from optionsx Jul 24, 2023
@violentmonkey violentmonkey deleted a comment from optionsx Jul 24, 2023
@violentmonkey violentmonkey locked as off-topic and limited conversation to collaborators Jul 24, 2023
@tophf tophf added the interoperability interoperability of userscript engines, a difference in behavior label Jul 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement external interoperability interoperability of userscript engines, a difference in behavior
Projects
None yet
Development

No branches or pull requests

5 participants