Open michaelhly opened 5 years ago
csrfmiddlewaretoken: xxx
login: xxx
password: xxx
next: /
recaptcha_token: xxx
Not familiar with this, but I check the request/response on leetcode website and saw this recaptcha_token, can anyone educate me what is effect of this token here? Thanks.
https://developers.google.com/recaptcha/intro
Welcome to the reCAPTCHA developer documentation.
reCAPTCHA protects you against spam and other types of automated abuse. Here, we explain how to add reCAPTCHA to your site or application.
+1, code here https://github.com/leetcode-tools/leetcode-cli does not work either.
most probably, leetcode recently enhance the security set of its API, that's why our login request failed. I am trying to fix this issue, but no luck yet...
I am not handly on JS, possibly this captcha-solver may help? Thanks!
It seems I'm able to get the cli working by manually logging into the site in a browser, viewing the cookies, and creating the ~/.lc/leetcode/user.json
by hand. My file looks like ...
{
"login": "[username]",
"loginCSRF": "",
"sessionCSRF": "[copied from csrftoken]",
"sessionId": "[copied from LEETCODE_SESSION]"
}
Currently, I've only tested showing my account status and listing problems.
It seems I'm able to get the cli working by manually logging into the site in a browser, viewing the cookies, and creating the
~/.lc/leetcode/user.json
by hand. My file looks like ...{ "login": "[username]", "loginCSRF": "", "sessionCSRF": "[copied from csrftoken]", "sessionId": "[copied from LEETCODE_SESSION]" }
Currently, I've only tested showing my account status and listing problems.
I am trying your tips. But I don't know how can I find my LEETCODE_SESSION. Could you tell me where I can find it?
It seems I'm able to get the cli working by manually logging into the site in a browser, viewing the cookies, and creating the
~/.lc/leetcode/user.json
by hand. My file looks like ...{ "login": "[username]", "loginCSRF": "", "sessionCSRF": "[copied from csrftoken]", "sessionId": "[copied from LEETCODE_SESSION]" }
Currently, I've only tested showing my account status and listing problems.
I am trying your tips. But I don't know how can I find my LEETCODE_SESSION. Could you tell me where I can find it?
After logging into LeetCode I'm using the storage inspector to grab the cookie values, https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector.
It seems I'm able to get the cli working by manually logging into the site in a browser, viewing the cookies, and creating the
~/.lc/leetcode/user.json
by hand. My file looks like ...{ "login": "[username]", "loginCSRF": "", "sessionCSRF": "[copied from csrftoken]", "sessionId": "[copied from LEETCODE_SESSION]" }
Currently, I've only tested showing my account status and listing problems.
I am trying your tips. But I don't know how can I find my LEETCODE_SESSION. Could you tell me where I can find it?
After logging into LeetCode I'm using the storage inspector to grab the cookie values, https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector.
Thank you very much for the quick reply!
I sovled this problem by using cookie.chrome plugin. Seems need to disable some other plugins to make it works.
leetcode plugin -d leetcode.cn
leetcode plugin -d lintcode
leetcode user -l -v
I faced the same problem. Even after using the token I get locked question error with my premium account.
You can try this workshop based on leetcode-cli
for workaround: https://github.com/luxp/leetcode-workshop-javascript
Instead of submit with cli, it will automatically copy the submit content to the clipboard and open the problem page. You just need to paste it.
And by the way, you can use jest to test your code locally, which is really helpful and fast for debug and verification.
For those who want to find data below, just go to chrome and paste this
chrome://settings/cookies/detail?site=leetcode.com
{
"login": "[username]",
"loginCSRF": "",
"sessionCSRF": "[copied from csrftoken]",
"sessionId": "[copied from LEETCODE_SESSION]"
}
It seems like the link above no longer works: Go to leetcode.com and open inspect tab
Paste this in the console and press enter: Object.fromEntries(document.cookie.split('; ').map(v=>v.split(/=(.*)/s).map(decodeURIComponent)))
Then you should see it return your cookies. You can then copy sessionCSRF from csrftoken
and sessionId
from [xxxxxxxx]_gr_session_id
For those who want to find data below, just go to chrome and paste this
chrome://settings/cookies/detail?site=leetcode.com
{ "login": "[username]", "loginCSRF": "", "sessionCSRF": "[copied from csrftoken]", "sessionId": "[copied from LEETCODE_SESSION]" }
love u bro
For those who want to find data below, just go to chrome and paste this对于那些想在下面找到数据的人,只需转到 chrome 并粘贴即可
chrome://settings/cookies/detail?site=leetcode.comchrome://settings/cookies/detail?site=leetcode.com
{ "login": "[username]", "loginCSRF": "", "sessionCSRF": "[copied from csrftoken]", "sessionId": "[copied from LEETCODE_SESSION]" }
The plugin was working fine before then I uninstalled and reinstalled vim as well as installed the plugin and couldn't log in later. I tried your method, I don't know what I filled in wrong, can you correct me? Thank you! Linux localhost 5.10.43 #1 SMP PREEMPT Thu Aug 18 17:40:54 CST 2022 aarch64 Android
@shalimujiang I have made an edit in my comment above and I think the values can be obtained using another way. Hope it works :)
@shalimujiang how you launch command "leetcode user -l" using user.json?
Problem Summary
Recently bought premium and can't seem to log in anymore.
How to reproduce
Ran
./bin/leetcode user --login -vv
Get:[ERROR] invalid password?
(403 forbidden)Here is the full trace:
Environment