-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Bug]: GitHub login status gets lost after restarting of code-server daemon #5072
Comments
Tried chrome also, no luck, still need a re-login. |
I have the same issue. Previously (up to code-server v4.1.0) the credentials were stored in the browser storage (maybe indexed DB or local storage - haven't checked it in detail). Since code-server v4.2.0 the credentials are not stored in the browser anymore, but apparently they are stored in-memory on the server. Thus restarting the server causes it to forget them (as described above). The following log might be related to this, since it mentions switching to an in-memory credential store because
|
I created this to solve the problem. Since vscode expects keytar I just implemented it in NodeJS and had it write to a file. It does not perform the same keyring activity that the original does - it's more or less a simple keystore. https://github.com/stevenlafl/node-keytar/blob/master/lib/keytar.js You can encrypt it with environment variable ENCRYPTION_KEY, though it's visible to VSCode, so I am not sure how useful that feature is to anyone yet. So, in a Dockerfile:
Then volume mount |
Hmm... @code-asher what are your thoughts on how we can fix this? 🤔 Re-reading the comments seems like upstream moved this out of |
Huh yeah my memory is also that it used to be in browser storage so if they moved it out that would explain the problem. Our Linux builds were silently not including keytar (yarn failed to build but never errored) because we were missing the libsecret dependency which I think we added recently so hopefully that means it stops using the in-memory store (from 4.9.1 onward I think). |
Is there another way we could store secrets without relying on |
I think a proposal to change secret storage would make more sense
upstream rather than a patch here in code-server but there might
be an existing method that works better because Codespaces does
not seem to spawn dbus yet presumably secrets work there. So if
we can figure that out maybe we can leverage it in code-server.
|
Just in case this is useful I was experimenting with how one might get keytar working and this did the trick:
Unfortunate that the password has to be provided like this though. Maybe there is a better way to unlock the keyring or maybe there is a different keyring that would work better (one that could ask for the password through Code might be ideal). |
GH login session will still expire if the code-server daemon is restarted on v4.13.0 I restart my server every morning to free the memory etc...So I have to log in to copilot and GH repo every day...I hope we can solve this issue and it would save much of time. Appreciate it! |
I have this same isuue. |
The same issue on v4.16.1. |
Same issue here. |
Yeah for a long time I didn't have this problem, on the newer versions I do again (4.16.1) In fact, its even worse in the sense that every time I reload I have to re-login |
I need to know when this problem is going to be fixed? |
Is the session still lost if running code-server with dbus? If so
that sounds like a bug.
Making secrets work without dbus is not something I have time to
do at the moment but maybe it would make sense to propose a change
upstream.
If it is not something upstream is willing to consider we could
try patching secret storage in code-server if the changes are
reasonably succinct.
|
I attempted to run code-server with dbus using this command:
However, the issue still persists. |
When will this issue be resolved? Is there any temporary solution I can implement? |
@Zai-Kun You can either set Cross references: |
Thanks, it seems to be working now. |
P.S.: The same applies for the GitLab Workflow extensions, i.e. set environment variables |
@code-asher Yes, please have a look at this. As @AntoineMorcos pointed out in #6408, VS Code moved away from keytar (due to its archival) in favor of Electron's safeStorage API since version 1.80 and higher. |
Interestingly it is not working for my version of the image. I will troubleshoot a bit more to figure out why, but it doesn't seem to be using the gitlab or github auth tokens from here. I've tried authenticating after setting the environment variable and it still comes back unauthenticated once I open another window. |
Correct. E.g. |
@benz0li copilot is still asking to sign in using github, each time i quit server and open again. I generated my personal access token with the repo and user scope as you said, putting it in GITHUB_TOKEN environment variable and starting code-server with: |
@rohit901 I never claimed that this method works with GitHub Copilot1. My advice: Keep your hands off GitHub Copilot. Footnotes
|
Potentially related on Stack Overflow: VS Code with code-server (circa version 4.2.0-4.16.0) always asks for login credential after restart |
Is there an existing issue for this?
OS/Web Information
code-server --version
:4.2.0 693b1fac04524bb0e0cfbb93afc85702263329bb with Code 1.64.2
Steps to Reproduce
systemctl restart code-server@user
Expected
GitHub login status should persist, no need to re-login
Actual
extension asked to login again
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code?
Are you accessing code-server over HTTPS?
Notes
The disscussion may provide more infomation.
#5052
The text was updated successfully, but these errors were encountered: