coder / code-server

VS Code in the browser
https://coder.com
MIT License
66.63k stars 5.46k forks source link

How to make extension login persistent across devices? #6727

Closed balajib-b closed 3 days ago

balajib-b commented 3 months ago

What is your suggestion?

this feature to store the credentials of logins that we do in extensions (gitlab, mongodb, circleCI etc...) persistent across code-server reboot or login via a new device would save more time from creating new auth tokens from all those saas services and cut-off the time required to configure a new device. i miss the on-the-go access to my dev environment feel when i login via new device.

Why do you want this feature?

it makes job easier by not asking me to login each time i use my code-server from new device

Are there any workarounds to get this functionality today?

not that i know anything yet

Are you interested in submitting a PR for this?

i am not sure of the code server architecture yet.

balajib-b commented 3 months ago

@code-asher @benz0li any thoughts on this?

benz0li commented 3 months ago

[...] the secret storage went browser-only [...]

https://github.com/coder/code-server/pull/6450

benz0li commented 3 months ago

Set token with environment variables

If you often delete your VS Code storage (such as in Gitpod containers) you can create environment variables before starting VS Code. If you set the token in an environment variable you don't have to set the personal access token every time you delete your VS Code storage.

  • GITLAB_WORKFLOW_INSTANCE_URL: GitLab instance URL (e.g. https://gitlab.com).
  • GITLAB_WORKFLOW_TOKEN: personal access token, which you created during setup.

The token configured in an environment variable is overridden if you configure a token for the same GitLab instance in the extension.

GitLab Workflow

benz0li commented 3 months ago

IMHO more extensions should allow reading their token from an environment variable.

code-asher commented 3 months ago

We do patch user storage to go to disk instead of the browser so I think it would not be completely out of line to try moving secrets back to the disk as well, but I am not sure how easy it would be, and ideally we read both to prevent breaking existing secrets, or make it an option.

If it was made an option maybe we could even submit the idea upstream, surely Codespaces users might want to persist their credentials across multiple browsers/devices as well.

code-asher commented 3 months ago

Although I guess upstream will probably just say to use settings sync, which is not an option for code-server from what I understand.

But does settings sync copy credentials as well? Not sure about that.

code-asher commented 3 days ago

Duplicate of https://github.com/coder/code-server/issues/4212, which is itself closed because we are not going to try changing this although if someone wants to make an attempt that would be welcome!