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

Got user is not authenticated while execute leetcode-try #104

Open
BWbwchen opened this issue May 22, 2022 · 12 comments
Open

Got user is not authenticated while execute leetcode-try #104

BWbwchen opened this issue May 22, 2022 · 12 comments

Comments

@BWbwchen
Copy link

I got 'use is not authenticated' when I try to execute my code. Below is the output message:

HTTP/1.1 403 Forbidden
Date: Sun, 22 May 2022 11:36:09 GMT
Content-Type: application/json
Content-Length: 38
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=BL8w9G4K70%2BHlKXW42IlBckyC71hC5XpAJsHmho6WEPHsMij%2Fe4nThfQdu%2B0m%2FKiaOh7IlEry6%2FTefdQe86zWo%2BBJzn2HozBKhkZyLFJb2oFzKTqVbEnWmuklZCGEQ%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: 70f540a3ce838a50-NRT

{"error": "User is not authenticated"}

Could anyone kindly help me? Thx.

@kaiwk
Copy link
Owner

kaiwk commented Jun 1, 2022

You need to install my-cookies and make sure Emacs inherit PATH variable, so that Emacs can find my_cookies. You can test it with eshell or eval (executable-find "my_cookies").

You also need to login leetcode.com in Firefox/Chrome first, my_cookies will retrieve leetcode.com cookies from these browsers.

Related issues: #72, #46

@kaiwk kaiwk pinned this issue Jun 1, 2022
@YorkZ
Copy link

YorkZ commented Jun 13, 2022

I'm having this issue as well. I use Arch Linux, and installed leetcode.el through straight.el. I also verified that (executable-find "my_cookies") returned the correct path. I logged in leetcode web interface in both Firefox and chromium.

@BWbwchen
Copy link
Author

I solve the problem by login the leetcode.com from the brave web browser. Maybe you can try it.

@YorkZ
Copy link

YorkZ commented Jun 14, 2022

Thanks @BWbwchen, I just installed the brave browser and tried this functionality, and it worked. Thank you.

@aljab012
Copy link

aljab012 commented Jul 31, 2022

  • If you have multiple user in chrome, make sure to login with leetcode on the main account.

@harryaskham
Copy link

Huh, am logged in in Chrome, Firefox and Brave, and running my_cookies on CLI shows the token.

The top of the debug log shows

22:23:18 [DEBUG] login session: redacted
22:23:18 [DEBUG] login csrftoken: redacted
22:23:21 [DEBUG] set user: , solved 0 in 2552 problems
...[problem list]

but the redacted tokens look good. Was working yesterday.

@swisstackle
Copy link

swisstackle commented Mar 5, 2023

Same problem. I use firefox
This is the output when I execute $ my_cookies in the terminal:

get cookie from Chrome failed
get cookie from Chromium failed
get cookie from Brave failed
get cookie from Firefox failed
get cookie from Microsoft Edge failed

I re logged in several time in firefox.

Seems like an issue with my_cookies's functionality in combo with firefox.

Update

I installed brave and logged into leetcode on there but the output of $ my_cookies stays the same.

@Yuanda-Dong
Copy link

Yuanda-Dong commented Mar 20, 2023

I'm on arch linux. I've got my_cookies to return the LEETCODE_SESSION and csrftoken, but when i tried to submit it still says user is not authenticated.

You probably will get this error when you try to run browser_cookie on arch. I added a None to the function call, and it worked.

File "/home/me/.local/lib/python3.10/site-packages/browser_cookie3/__init__.py", line 245, in get_password return self.__methods_map.get('kwallet')(os_crypt_name) TypeError: _LinuxPasswordManager.__get_kdewallet_password_jeepney() missing 1 required positional argument: 'key'

@lakkiy
Copy link
Contributor

lakkiy commented Mar 26, 2023

Is there a way I can set cookie manually ?

@IsakFalk
Copy link

For this to work I needed to run FF in a new fresh profile without any extensions. I think the privacy extensions may have interfered with the way leetcode.el interacts with the browser.

@lentil32
Copy link

macOS ARM, brave browser works thanks (brew install --cask brave-browser)

@tphil99
Copy link

tphil99 commented Feb 4, 2025

Had similar issue, caused by a Chrome update changing the API, breaking browser_cookie3.chrome. Solved by updating to development version of browser_cookie3: see https://stackoverflow.com/a/79134135/12305582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests