leetcode-cli
leetcode-cli copied to clipboard
登录不上,[ERROR] session expired, please login again [-1]
如题,登陆时始终报这个错误
please try "leetcode user -l -vv" to print more logs?
Sometimes succeeded sometimes failed to get a response. the log when pushing is as below
[DEBUG] running leetcode.submitProblem
⠋ Sending code to judge[TRACE] REQUEST %s { url: 'https://leetcode.com/problems/letter-combinations-of-a-phone-number/submit/',
headers:
{ Cookie:
[DEBUG] running leetcode.login [DEBUG] running leetcode.signin
- Signing in leetcode.com[TRACE] REQUEST %s { uri: 'https://leetcode.com/accounts/login/',
callback: [Function] }
[TRACE] REQUEST %s make request https://leetcode.com/accounts/login/
\ Signing in leetcode.com[TRACE] REQUEST %s onRequestResponse https://leetcode.com/accounts/login/ 403 { date: 'Tue, 03 Apr 2018 08:00:55 GMT',
'content-type': 'text/html; charset=UTF-8',
'transfer-encoding': 'chunked',
connection: 'close',
'set-cookie':
, 'cf-chl-bypass': '1', 'cache-control': 'max-age=2', expires: 'Tue, 03 Apr 2018 08:00:57 GMT', 'x-frame-options': 'SAMEORIGIN', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'x-content-type-options': 'nosniff', 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', server: 'cloudflare', 'cf-ray': '405a011b389b6e4a-SJC' } [TRACE] REQUEST %s reading response's body [TRACE] REQUEST %s finish init function https://leetcode.com/accounts/login/ [TRACE] REQUEST %s response end https://leetcode.com/accounts/login/ 403 { date: 'Tue, 03 Apr 2018 08:00:55 GMT', 'content-type': 'text/html; charset=UTF-8', 'transfer-encoding': 'chunked', connection: 'close', 'set-cookie': , 'cf-chl-bypass': '1', 'cache-control': 'max-age=2', expires: 'Tue, 03 Apr 2018 08:00:57 GMT', 'x-frame-options': 'SAMEORIGIN', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'x-content-type-options': 'nosniff', 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', server: 'cloudflare', 'cf-ray': '405a011b389b6e4a-SJC' } [TRACE] REQUEST %s end event https://leetcode.com/accounts/login/ [TRACE] REQUEST %s has body https://leetcode.com/accounts/login/ 4676 [TRACE] REQUEST %s emitting complete https://leetcode.com/accounts/login/ [DEBUG] http error: 403 [ERROR] session expired, please login again [-1]
需要在leetcode上注册账号,不是leetcode-cn。账号可以从leetcode同步到leetcode-cn中
Thanks @zidoshare
@Allenhua are u using leetcode-cn account above? Seems leetcode.com and leetcode-cn.com hold different accounts thus your login always failed.
没有,我用的是 leetcode 的账户,我的一台机器上没有问题,另一台有问题。
This is a network problem caused by GFW of the mainland of China. After establishing a VPN connect, the issue is solved.
@dodouwang are you sure?it is 403. sorry,I can not get any more
尝试换个网络看看。我是通过换成手机热点的移动网络登录解决的。
same problem.
I can login, error appeared when I leetcode submit xxxxx
@Ayanokouji-Kenn please show the response code.
cn campus network cannot login.such as: Error: connect ECONNREFUSED 104.27.160.90:443 [0] you can use mobile hotspot . 就是校园网不一定能登录(), 用流量
@zidoshare @skygragon
leetcode-cn.com
login successfully ,but can't submit.
>leetcode submit 1.two-sum.java
[ERROR] session expired, please login again [-1]
>leetcode user -l -vv
[TRACE] initializing all plugins
[TRACE] found plugin: cache=default
[TRACE] inited plugin: cache
[TRACE] found plugin: company=2017.12.18
[TRACE] inited plugin: company
[TRACE] found plugin: github=2018.03.24
[TRACE] inited plugin: github
[TRACE] found plugin: leetcode=default
[TRACE] inited plugin: leetcode
[TRACE] found plugin: retry=default
[TRACE] inited plugin: retry
[TRACE] found plugin: solution.discuss=2018.04.14
[TRACE] inited plugin: solution.discuss
[TRACE] missing plugins: 0
login: [email protected]
pass:
[DEBUG] running leetcode.login
[DEBUG] running leetcode.signin
- Signing in leetcode.com[TRACE] REQUEST %s { uri: 'https://leetcode-cn.com/accounts/login/',
callback: [Function] }
[TRACE] REQUEST %s make request https://leetcode-cn.com/accounts/login/
\ Signing in leetcode.com[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/accounts/login/ 200 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Thu, 21 Jun 2018 01:22:33 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '19105',
connection: 'close',
vary: 'Accept-Encoding, Cookie',
'x-frame-options': 'SAMEORIGIN',
'set-cookie': <hidden>,
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/accounts/login/
[TRACE] REQUEST %s response end https://leetcode-cn.com/accounts/login/ 200 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Thu, 21 Jun 2018 01:22:33 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '19105',
connection: 'close',
vary: 'Accept-Encoding, Cookie',
'x-frame-options': 'SAMEORIGIN',
'set-cookie': <hidden>,
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/accounts/login/
[TRACE] REQUEST %s has body https://leetcode-cn.com/accounts/login/ 19105
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/accounts/login/
[TRACE] REQUEST %s { url: 'https://leetcode-cn.com/accounts/login/',
headers:
{ Origin: 'https://leetcode-cn.com',
Referer: 'https://leetcode-cn.com/accounts/login/',
Cookie: <hidden> },
form:
{ csrfmiddlewaretoken: 'Iwc3jGfuvLLACoKN6ZsBYs3IV19VHoL8skoYfZfiLnFDXbQNJvh9uZ3xKb2b7Hll',
login: '******',
password: '******' },
callback: [Function],
method: 'POST' }
[TRACE] REQUEST %s make request https://leetcode-cn.com/accounts/login/
[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/accounts/login/ 302 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Thu, 21 Jun 2018 01:22:33 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '0',
connection: 'close',
location: '/',
'x-frame-options': 'SAMEORIGIN',
vary: 'Cookie',
'set-cookie':
<hidden>]"; HttpOnly; Path=/; Secure',
'csrftoken=uIZh6O2GQlpOHKqoGaUK2JghaJRo2ad3FNac0qcl8FxmwJ7NPFu8pFsf1rzitP0G; expires=Thu, 20-Jun-2019 01:22:33 GMT; Max-Age=31449600; Path=/; Secure',
'LEETCODE_SESSION=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJfYXV0aF91c2VyX2lkIjoiNTEzNyIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImFsbGF1dGguYWNjb3VudC5hdXRoX2JhY2tlbmRzLkF1dGhlbnRpY2F0aW9uQmFja2VuZCIsIl9hdXRoX3VzZXJfaGFzaCI6IjdlNmMzZWZlMTg5OGY4ZDdmZWVhMGVlZGNkM2IwZTUyM2Q5ZTE4ZWMiLCJpZCI6NTEzNywiZW1haWwiOiJ4dXpoaWxpbjg4MThAMTYzLmNvbSIsInVzZXJuYW1lIjoiQXlhbm9rb3VqaS1LZW5uIiwidXNlcl9zbHVnIjoiYXlhbm9rb3VqaS1rZW5uIiwiYXZhdGFyIjoiaHR0cHM6Ly9hbGl5dW4tbGMtdXBsb2FkLm9zcy1jbi1oYW5nemhvdS5hbGl5dW5jcy5jb20vYWxpeXVuLWxjLXVwbG9hZC91c2Vycy9heWFub2tvdWppLWtlbm4vYXZhdGFyXzE1MjA0MDc5NTgucG5nIiwicGhvbmVfdmVyaWZpZWQiOmZhbHNlLCJ0aW1lc3RhbXAiOiIyMDE4LTA2LTIxIDAxOjIyOjMzLjQ2MjkwNiswMDowMCIsIlJFTU9URV9BRERSIjoiNDkuNzUuNjEuMTg0IiwiSURFTlRJVFkiOiIiLCJfc2Vzc2lvbl9leHBpcnkiOjB9.1gddP5PT1A1eZffrtoHN5Rl0xK-mpnGyqGrgns4ySlk; HttpOnly; Path=/; Secure' ],
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s redirect /
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/accounts/login/
[TRACE] REQUEST %s response end https://leetcode-cn.com/accounts/login/ 302 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Thu, 21 Jun 2018 01:22:33 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '0',
connection: 'close',
location: '/',
'x-frame-options': 'SAMEORIGIN',
vary: 'Cookie',
'set-cookie':
<hidden>]"; HttpOnly; Path=/; Secure',
'csrftoken=uIZh6O2GQlpOHKqoGaUK2JghaJRo2ad3FNac0qcl8FxmwJ7NPFu8pFsf1rzitP0G; expires=Thu, 20-Jun-2019 01:22:33 GMT; Max-Age=31449600; Path=/; Secure',
'LEETCODE_SESSION=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJfYXV0aF91c2VyX2lkIjoiNTEzNyIsIl9hdXRoX3VzZXJfYmFja2VuZCI6ImFsbGF1dGguYWNjb3VudC5hdXRoX2JhY2tlbmRzLkF1dGhlbnRpY2F0aW9uQmFja2VuZCIsIl9hdXRoX3VzZXJfaGFzaCI6IjdlNmMzZWZlMTg5OGY4ZDdmZWVhMGVlZGNkM2IwZTUyM2Q5ZTE4ZWMiLCJpZCI6NTEzNywiZW1haWwiOiJ4dXpoaWxpbjg4MThAMTYzLmNvbSIsInVzZXJuYW1lIjoiQXlhbm9rb3VqaS1LZW5uIiwidXNlcl9zbHVnIjoiYXlhbm9rb3VqaS1rZW5uIiwiYXZhdGFyIjoiaHR0cHM6Ly9hbGl5dW4tbGMtdXBsb2FkLm9zcy1jbi1oYW5nemhvdS5hbGl5dW5jcy5jb20vYWxpeXVuLWxjLXVwbG9hZC91c2Vycy9heWFub2tvdWppLWtlbm4vYXZhdGFyXzE1MjA0MDc5NTgucG5nIiwicGhvbmVfdmVyaWZpZWQiOmZhbHNlLCJ0aW1lc3RhbXAiOiIyMDE4LTA2LTIxIDAxOjIyOjMzLjQ2MjkwNiswMDowMCIsIlJFTU9URV9BRERSIjoiNDkuNzUuNjEuMTg0IiwiSURFTlRJVFkiOiIiLCJfc2Vzc2lvbl9leHBpcnkiOjB9.1gddP5PT1A1eZffrtoHN5Rl0xK-mpnGyqGrgns4ySlk; HttpOnly; Path=/; Secure' ],
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/accounts/login/
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/accounts/login/
[DEBUG] running leetcode.getFavorites
[TRACE] REQUEST %s { url: 'https://leetcode-cn.com/list/api/questions',
headers:
{ Cookie: <hidden>,
'X-CSRFToken': <hidden>,
'X-Requested-With': 'XMLHttpRequest' },
callback: [Function] }
[TRACE] REQUEST %s make request https://leetcode-cn.com/list/api/questions
[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/list/api/questions 200 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Thu, 21 Jun 2018 01:22:33 GMT',
'content-type': 'application/json',
'content-length': '366',
connection: 'close',
vary: 'Accept-Encoding, Cookie',
allow: 'GET, POST, PUT, DELETE, HEAD, OPTIONS',
'x-frame-options': 'SAMEORIGIN',
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/list/api/questions
[TRACE] REQUEST %s response end https://leetcode-cn.com/list/api/questions 200 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Thu, 21 Jun 2018 01:22:33 GMT',
'content-type': 'application/json',
'content-length': '366',
connection: 'close',
vary: 'Accept-Encoding, Cookie',
allow: 'GET, POST, PUT, DELETE, HEAD, OPTIONS',
'x-frame-options': 'SAMEORIGIN',
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/list/api/questions
[TRACE] REQUEST %s has body https://leetcode-cn.com/list/api/questions 366
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/list/api/questions
Successfully login as Ayanokouji-Kenn
I have the same problem:
[TRACE] initializing all plugins
[TRACE] found plugin: cache=default
[TRACE] inited plugin: cache
[TRACE] found plugin: leetcode.cn=2018.05.30
[TRACE] inited plugin: leetcode.cn
[TRACE] found plugin: leetcode=default
[TRACE] inited plugin: leetcode
[TRACE] found plugin: retry=default
[TRACE] inited plugin: retry
[TRACE] missing plugins: 0
[DEBUG] cache hit: problems.json
[DEBUG] cache hit: 1.two-sum.algorithms.json
[DEBUG] running leetcode.submitProblem
- Sending code to judge[TRACE] REQUEST %s { url: 'https://leetcode-cn.com/problems/two-sum/submit/',
headers:
{ Cookie: <hidden>,
'X-CSRFToken': <hidden>,
'X-Requested-With': 'XMLHttpRequest',
Origin: 'https://leetcode-cn.com',
Referer: 'https://leetcode.com/problems/two-sum/description/' },
body:
{ judge_type: 'large',
lang: 'java',
question_id: 1,
test_mode: false,
typed_code: '/*\n * [1] Two Sum\n *\n * https://leetcode.com/problems/two-sum/description/\n *\n * algorithms\n * Easy (38.64%)\n * Total Accepted: 1M\n * Total Submissions: 2.6M\n * Testcase Example: \'[2,7,11,15]\\n9\'\n *\n * Given an array of integers, return indices of the two numbers such that they\n * add up to a specific target.\n * \n * You may assume that each input would have exactly one solution, and you may\n * not use the same element twice.\n * \n * Example:\n * \n * \n * Given nums = [2, 7, 11, 15], target = 9,\n * \n * Because nums[0] + nums[1] = 2 + 7 = 9,\n * return [0, 1].\n * \n * \n * \n * \n */\nclass Solution {\n public int[] twoSum(int[] nums, int target) {\n return null;\n }\n}\n' },
method: 'POST',
json: true,
_delay: 1,
callback: [Function] }
[TRACE] REQUEST %s make request https://leetcode-cn.com/problems/two-sum/submit/
- Sending code to judge[TRACE] REQUEST %s onRequestResponse https://leetcode-cn.com/problems/two-sum/submit/ 403 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Tue, 14 Aug 2018 09:48:18 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '5867',
connection: 'close',
vary: 'Accept-Encoding, Cookie',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com',
'x-frame-options': 'SAMEORIGIN',
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s reading response's body
[TRACE] REQUEST %s finish init function https://leetcode-cn.com/problems/two-sum/submit/
[TRACE] REQUEST %s response end https://leetcode-cn.com/problems/two-sum/submit/ 403 { server: 'nginx/1.10.3 (Ubuntu)',
date: 'Tue, 14 Aug 2018 09:48:18 GMT',
'content-type': 'text/html; charset=utf-8',
'content-length': '5867',
connection: 'close',
vary: 'Accept-Encoding, Cookie',
'content-security-policy': 'frame-ancestors \'self\' https://*.leetcode.com https://leetcode.com https://*.leetcode-cn.com https://leetcode-cn.com https://*.lingkou.com https://lingkou.com https://tongji.baidu.com https://www.growingio.com',
'x-frame-options': 'SAMEORIGIN',
'strict-transport-security': 'max-age=315360000; includeSubDomains' }
[TRACE] REQUEST %s end event https://leetcode-cn.com/problems/two-sum/submit/
[TRACE] REQUEST %s has body https://leetcode-cn.com/problems/two-sum/submit/ 5867
[TRACE] REQUEST %s invalid JSON received https://leetcode-cn.com/problems/two-sum/submit/
[TRACE] REQUEST %s emitting complete https://leetcode-cn.com/problems/two-sum/submit/
[DEBUG] http error: 403
[ERROR] session expired, please login again [-1]
在美国也出错 401. 这个问题困扰这个工具的最大优势
[DEBUG] running cookie.chrome.login
[DEBUG] running cookie.chrome.signin
[DEBUG] try to copy leetcode cookies from chrome ...
[DEBUG] Successfully copied leetcode cookies!
[DEBUG] running leetcode.getFavorites
[TRACE] REQUEST %s { url: 'https://leetcode.com/list/api/questions',
headers:
{ Cookie:
@Allenhua leetcode plugin -D leetcode.cn 我用的leetcode.com的账号,期初也登录不上去,用上面的命令把leetcode.cn插件删掉就可以登录了。
@yumumu 刚更新了一下,现在leetcode/lintcode/leetcode.cn插件使用独立的目录来保存数据,应该不会有这种数据冲突的问题了
https://github.com/skygragon/leetcode-cli/commit/b72d4d69fe6b3279d3f40f00bb836696139a2fcc https://github.com/skygragon/leetcode-cli-plugins/commit/5ef609e75e3f19451d83ccd61e70b669d972e640
Sorry, it's because of lintcode plugin.....All work well after I disable that plugin.
~~Can login, but can't get a session.~~
mickir@matrixlib [19:57:56] [~/src/leetcode] [master]
-> % leetcode user -l -v
login: [email protected]
pass:
[DEBUG] running lintcode.login
Successfully login as [email protected]
Time: 0h:00m:08s
mickir@matrixlib [19:58:16] [~/src/leetcode] [master]
-> % leetcode session
[ERROR] session expired, please login again [code=-1]
不能同时登录网页和插件吗?我以前可以的啊今天登插件掉网页登网页掉插件。。。。
看看是不是邮箱未验证,我的验证下就解决了
有的是Cloudflare拦截了,尽量避免频繁切换设备和代理节点