kaiwk / leetcode.el

An Emacs LeetCode client.
GNU General Public License v3.0
396 stars 70 forks source link

Unable to login, CSRF verification failed #93

Open spiwocoal opened 2 years ago

spiwocoal commented 2 years ago

I can't seem to send code to Leetcode from Emacs, every time I try using leetcode-try, I get an error with status code 499, and a HTML doc saying the CSRF verification failed, and that I need to enable cookies on my browser. The part with the status code is:

HTTP/1.1 499 Unknown Status Code
Date: Mon, 30 Aug 2021 22:33:24 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Frame-Options: DENY
Vary: Cookie
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=X9mUHu33hCDvO6OxEPSIhTVgD9DvAMNen4qI%2BtJsSVYhkdkqrc%2Bpw5phA2zGOpkPvV6Cb23Qn%2BYC91hue02uH5492o2TmlIQW%2FAtlMdjjo7GEv3tvIisJbnfnPqAQg%3D%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
X-Content-Type-Options: nosniff
Server: cloudflare
CF-RAY: 68717b07cf3885aa-SCL

Weird thing is, I checked my_cookies was working properly and that Emacs had access to the appropriate cookies (and that I was logged in to Leetcode), so I have no idea why this could be happening.

catern commented 2 years ago

I'm having the same issue, 499 status code, CSRF verification failed. Perhaps Leetcode changed something?

kaiwk commented 2 years ago

I tested it with Doom Emacs on mac, using Chrome, and it works fine...

spiwocoal commented 2 years ago

i am using Firefox, maybe that's why...

once i get home i will try using chromium, if that doesn't work either i'll try using another distro

YorkZ commented 2 years ago

I'm having this problem as well. I use Arch Linux, and have logged in to leetcode web interface in both Firefox and Chromium.

ileixe commented 6 months ago

Same here. I can see leetcode session from my_cookies command but 499 returned.

KAction commented 4 months ago

I have the same, and I believe that token that leetcode.el extracts from the browser gets invalidated once you visit leetcode.el again with browser.