403 from leetcode.com
xiaoheiAh opened this issue · 3 comments
xiaoheiAh commented
Problem Summary
when I login, response is [ERROR] invalid password?,use -vv print following log.
➜ ~ leetcode user -l -vv
[TRACE] initializing all plugins
[TRACE] found plugin: cache=default
[TRACE] found plugin: leetcode=default
[TRACE] found plugin: retry=default
[TRACE] inited plugin: leetcode
[TRACE] inited plugin: retry
[TRACE] inited plugin: cache
login: xiaoheiah
pass:
[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/ 200 { date: 'Wed, 04 Dec 2019 11:12:53 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
'set-cookie':
[ '__cfduid=ddcbb807f38de507c8d23d1a0611122801575457973; expires=Fri, 03-Jan-20 11:12:53 GMT; path=/; domain=.leetcode.com; HttpOnly',
'csrftoken=96rz7TMTCXYBpk2oXXisc96m7VyHurZvWgvK06tbsXf8qQhNyYSuOmoN969uEWb6; expires=Wed, 02 Dec 2020 11:12:53 GMT; Max-Age=31449600; Path=/; SameSite=Lax; Secure' ],
vary: 'Accept-Encoding, Cookie',
'x-frame-options': 'SAMEORIGIN',
'cf-cache-status': 'DYNAMIC',
'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': '53fd590f8817ed1b-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/ 200 { date: 'Wed, 04 Dec 2019 11:12:53 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
'set-cookie':
[ '__cfduid=ddcbb807f38de507c8d23d1a0611122801575457973; expires=Fri, 03-Jan-20 11:12:53 GMT; path=/; domain=.leetcode.com; HttpOnly',
'csrftoken=96rz7TMTCXYBpk2oXXisc96m7VyHurZvWgvK06tbsXf8qQhNyYSuOmoN969uEWb6; expires=Wed, 02 Dec 2020 11:12:53 GMT; Max-Age=31449600; Path=/; SameSite=Lax; Secure' ],
vary: 'Accept-Encoding, Cookie',
'x-frame-options': 'SAMEORIGIN',
'cf-cache-status': 'DYNAMIC',
'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': '53fd590f8817ed1b-SJC' }
[TRACE] REQUEST %s end event https://leetcode.com/accounts/login/
[TRACE] REQUEST %s has body https://leetcode.com/accounts/login/ 32265
[TRACE] REQUEST %s emitting complete https://leetcode.com/accounts/login/
[TRACE] REQUEST %s { url: 'https://leetcode.com/accounts/login/',
headers:
{ Origin: 'https://leetcode.com',
Referer: 'https://leetcode.com/accounts/login/',
Cookie:
<hidden> },
form:
{ csrfmiddlewaretoken:
'96rz7TMTCXYBpk2oXXisc96m7VyHurZvWgvK06tbsXf8qQhNyYSuOmoN969uEWb6',
login: '***',
password: '****' },
callback: [Function],
method: 'POST' }
[TRACE] REQUEST %s make request https://leetcode.com/accounts/login/
[TRACE] REQUEST %s onRequestResponse https://leetcode.com/accounts/login/ 403 { date: 'Wed, 04 Dec 2019 11:12:54 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
'set-cookie':
[ '__cfduid=d7a660ac687d982c516ccbc487ae0adce1575457974; expires=Fri, 03-Jan-20 11:12:54 GMT; path=/; domain=.leetcode.com; HttpOnly',
'csrftoken=96rz7TMTCXYBpk2oXXisc96m7VyHurZvWgvK06tbsXf8qQhNyYSuOmoN969uEWb6; expires=Wed, 02 Dec 2020 11:12:54 GMT; Max-Age=31449600; Path=/; SameSite=Lax; Secure' ],
vary: 'Cookie',
'x-frame-options': 'SAMEORIGIN',
'cf-cache-status': 'DYNAMIC',
'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': '53fd5914d9cb6c2c-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: 'Wed, 04 Dec 2019 11:12:54 GMT',
'content-type': 'text/html; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
'set-cookie':
[ '__cfduid=d7a660ac687d982c516ccbc487ae0adce1575457974; expires=Fri, 03-Jan-20 11:12:54 GMT; path=/; domain=.leetcode.com; HttpOnly',
'csrftoken=96rz7TMTCXYBpk2oXXisc96m7VyHurZvWgvK06tbsXf8qQhNyYSuOmoN969uEWb6; expires=Wed, 02 Dec 2020 11:12:54 GMT; Max-Age=31449600; Path=/; SameSite=Lax; Secure' ],
vary: 'Cookie',
'x-frame-options': 'SAMEORIGIN',
'cf-cache-status': 'DYNAMIC',
'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': '53fd5914d9cb6c2c-SJC' }
[TRACE] REQUEST %s end event https://leetcode.com/accounts/login/
[TRACE] REQUEST %s emitting complete https://leetcode.com/accounts/login/
[ERROR] invalid password?How to reproduce
Environment
- leetcode-cli version: 2.6.2
- OS version: macos 10.15
- Node version: v10.16.0
- Npm version: v6.9.0
gopakumar commented
Leetcode login says "This site is protected by reCAPTCHA and the Google"
ianding1 commented
A doable approach is to read the LeetCode session cookie from the browser (it requires you to login in the browser first).
Reading LEETCODE_SESSION is sufficient to pass the authentication. The CSRF token and other cookies can be ignored.
xiaoheiAh commented
it works for me to enable leetcode-cli plugin "cookie.chrome".