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

I have to login with Github on every launch for sync to work. #426

Open
DeepDoge opened this issue Aug 20, 2023 · 31 comments
Open

I have to login with Github on every launch for sync to work. #426

DeepDoge opened this issue Aug 20, 2023 · 31 comments

Comments

@DeepDoge
Copy link

I have to login with Github on every launch for Copilot, and VSCode's Sync to work.

Might be related: StackOverflow - "Sign in to GitHub" prompt to enable GitHub Copilot on every VS Code launch

@DeepDoge DeepDoge changed the title I have to login with Github on every launch. I have to login with Github on every launch for sync to work. Aug 20, 2023
@miguelfito
Copy link

Same problem here! 🤚🏼 It's annoying! 😭

@driedpampas
Copy link

Same problem 😭 😭
image

@karuboniru
Copy link

Edit ~/.vscode/argv.json
Add "password-store": "gnome" to the file
If you are not using gnome or simliar desktop refer to https://code.visualstudio.com/docs/editor/settings-sync#_recommended-configure-the-keyring-to-use-with-vs-code

@colorfulmoth
Copy link

@karuboniru Attempted to do that, but it seems that the option password-store is disabled. The option has no effect

image

Aside from that, after some testing found out that it does work when passed as an argument when launching the flatpak like this

flatpak run com.visualstudio.code --password-store="gnome"

@karuboniru
Copy link

Attempted to do that, but it seems that the option password-store is disabled. The option has no effect

I believe it is false alarm since the option in file worked for me.

@jurf
Copy link
Member

jurf commented Nov 14, 2023

Did not help for me. Tried as a CLI argument and in argv.json. Always get a hang on activating Copilot, on a kill and relaunch it wants the password again. Output shows it correctly finds the configuration, even without any help, so it can be a related but different issue.

@jurf
Copy link
Member

jurf commented Nov 15, 2023

Using --password-store="basic" works, so I guess that is the workaround for me currently unfortunately. Might be tied to the OS? I'm running Fedora Silverblue 39 with GNOME.

@jurf
Copy link
Member

jurf commented Nov 15, 2023

Okay, this is very strange. Now I can use --password-store="gnome" and it works, but if I omit it completely, VSCode always hangs (even though, according to the output, it chooses the same store).

@CheariX
Copy link

CheariX commented Dec 22, 2023

I needed to sign in once with --password-store="basic". After that, it worked for my in any case, i.e. with --password-store="gnome" and even without any additional parameter. Strange...

@oryband
Copy link

oryband commented Jan 1, 2024

Using "basic" password option is a security vulnerability https://code.visualstudio.com/docs/editor/settings-sync#_not-recommended-configure-basic-text-encryption

@djfjeff
Copy link

djfjeff commented Jan 15, 2024

The issue is still present today, have to log in to Github every time I restart VScode. Tried all the workaround and nothing works.

@DeepDoge
Copy link
Author

DeepDoge commented Jan 15, 2024

I ended up changing to Bluefin image of Fedora Silverblue. It has non-flatpak vscode built-in with distrobox, so idk if the issue still exists.

@m-fariz-a
Copy link

Yes, the issue is still exist

@mdrokz
Copy link

mdrokz commented Feb 27, 2024

Im having the same issue with fedora silverblue 39 is there any update to this ?

@DeepDoge
Copy link
Author

DeepDoge commented Feb 27, 2024

Im having the same issue with fedora silverblue 39 is there any update to this ?

just use the bluefin image, or install it inside a distrobox, but i think silverblue has toolbox by
default you can use it i guess

  • create an Ubuntu toolbox/distrobox
  • install vscode in it
  • also install gnome keyring in it (this is for the same github login issue)

then you can just run it from command line or create a .desktop file, or if you are using distrobox you can use the built in distrobox-export command.
i would also set a different home folder for the distrobox, so random vscode related (.) directories or files doesn't end up in my home folder root. i use ~/Pods/vscode as my vscode's home folder.
you can also link dconf inside the vscode's home folder, so it can see your gnome theme and if your system in dark or light mode and etc.

@m-fariz-a
Copy link

Im having the same issue with fedora silverblue 39 is there any update to this ?

I just layer vscode using rpm ostree. I know this is not the best method, but at least all the issues gone.

@mdrokz
Copy link

mdrokz commented Feb 28, 2024

Im having the same issue with fedora silverblue 39 is there any update to this ?

just use the bluefin image, or install it inside a distrobox, but i think silverblue has toolbox by default you can use it i guess

* create an Ubuntu toolbox/distrobox

* install vscode in it

* also install gnome keyring in it (this is for the same github login issue)

then you can just run it from command line or create a .desktop file, or if you are using distrobox you can use the built in distrobox-export command. i would also set a different home folder for the distrobox, so random vscode related (.) directories or files doesn't end up in my home folder root. i use ~/Pods/vscode as my vscode's home folder. you can also link dconf inside the vscode's home folder, so it can see your gnome theme and if your system in dark or light mode and etc.

im using toolbox from beginning and i had installed gnome-keyring and libsecret and for some reason its still not working i followed all the steps that you mentioned

@DeepDoge
Copy link
Author

@mdrokz it might require different steps on toolbox maybe? i use distrobox.
gonna check it out when i have time.

@jurf
Copy link
Member

jurf commented Feb 28, 2024

Okay, this is very strange. Now I can use --password-store="gnome" and it works, but if I omit it completely, VSCode always hangs (even though, according to the output, it chooses the same store).

Yeah, I am pretty sure this just influences the race condition but does not fix it, it still hangs sometimes. The only proper workaround for me was to use --password-store="basic".

@mdrokz
Copy link

mdrokz commented Feb 28, 2024

@mdrokz it might require different steps on toolbox maybe? i use distrobox.
gonna check it out when i have time.

Yeah maybe thanks if you figure it out let us know :) I will also try to find a solution.

@DeepDoge
Copy link
Author

DeepDoge commented Feb 29, 2024

@mdrokz Ok, I checked.

For toolbox:

  • I first created a toolbox with the name "devbox" you can name it anything else:
toolbox create devbox

This automatically used the image fedora-toolbox:38 to create the container for me.

  • Then I entered the toolbox:
toolbox enter devbox
  • Then i followed the vscode installation instructions for fedora on the vscode's site.
  • Then I installed the gnome-keyring (for github login to work on vscode):
sudo dnf install gnome-keyring

Also had to install libsecret:

sudo dnf install libsecret

And done, it works. Just make sure everything is installed.
GitHub login works. When I close and reopen vscode, it stays logged in, as expected.

If you are not in the container you can start vscode directly with:

toolbox run --container devbox code

But I have noticed an issue with toolbox:
When vscode tries to open a link with the default browser nothing happens.
This is a big issue because it both annoying and in order to login GitHub you have to cancel the login and "try with another method" 2 times until you get the login with https://github.com/login/device option. And I'm pretty sure this will cause other problems too.

So I found this issue on github: containers/toolbox#291
I did these to fix the issue:

  • First entered the toolbox container
toolbox enter devbox
  • Then installed the flatpak-xdg-utils
sudo dnf install flatpak-xdg-utils
  • After that removed the xdg-open from /usr/bin/xdg-open
    (You can also move it to somewhere else instead)
sudo rm -f /usr/bin/xdg-open

Then linked the flatpak-xdg-open in place of it.

sudo ln -s /usr/bin/flatpak-xdg-open /usr/bin/xdg-open

And now everything works!

Also as bonus, you can add this option to vscode settings json:

"window.titleBarStyle": "custom"

It will make the titlebar look nicer

@mdrokz
Copy link

mdrokz commented Mar 1, 2024

@mdrokz Ok, I checked.

For toolbox:

  • I first created a toolbox with the name "devbox" you can name it anything else:
toolbox create devbox

This automatically used the image fedora-toolbox:38 to create the container for me.

  • Then I entered the toolbox:
toolbox enter devbox
  • Then i followed the vscode installation instructions for fedora on the vscode's site.
  • Then I installed the gnome-keyring (for github login to work on vscode):
sudo dnf install gnome-keyring

Also had to install libsecret:

sudo dnf install libsecret

And done, it works. Just make sure everything is installed.
GitHub login works. When I close and reopen vscode, it stays logged in, as expected.

If you are not in the container you can start vscode directly with:

toolbox run --container devbox code

But I have noticed an issue with toolbox:
When vscode tries to open a link with the default browser nothing happens.
This is a big issue because it both annoying and in order to login GitHub you have to cancel the login and "try with another method" 2 times until you get the login with https://github.com/login/device option. And I'm pretty sure this will cause other problems too.

So I found this issue on github: containers/toolbox#291
I did these to fix the issue:

  • First entered the toolbox container
toolbox enter devbox
  • Then installed the flatpak-xdg-utils
sudo dnf install flatpak-xdg-utils
  • After that removed the xdg-open from /usr/bin/xdg-open
    (You can also move it to somewhere else instead)
sudo rm -f /usr/bin/xdg-open

Then linked the flatpak-xdg-open in place of it.

sudo ln -s /usr/bin/flatpak-xdg-open /usr/bin/xdg-open

And now everything works!

Also as bonus, you can add this option to vscode settings json:

"window.titleBarStyle": "custom"

It will make the titlebar look nicer

Hi sorry for the late reply, yes I followed all of these steps in the toolbox before for some reason it isn't working for me, how did you install vscode in the toolbox ?

Also thanks for taking the time to find the browser fix I will try that.

@DeepDoge
Copy link
Author

DeepDoge commented Mar 2, 2024

@mdrokz
Copy link

mdrokz commented Mar 3, 2024

@mdrokz https://code.visualstudio.com/docs/setup/linux#_rhel-fedora-and-centos-based-distributions

What is the problem you're having exactly?

Hi @DeepDoge sorry for the late reply, I just restarted my PC and it seems to be working properly now thanks for all the help! I appreciate it.

@francoism90
Copy link

I have the same issue again, it worked fine before. :/

Does anyone know a workaround? I open and close VSCode frequently, having to login every time isn't that fun.

@sofrlachapelle
Copy link

Enable MFA/2FA on your github account or whatever account you use to sync.
Then, launch vscode once with:
flatpak run com.visualstudio.code --password-store="basic"
Or, open vscode then open the command pallet and search for "Configure Runtime Arguments".
When argv.json opens, add the following at the bottom of the json object:
"password-store": "basic" //Use basic text encryption.
Screenshot from 2024-04-24 21-16-26

@realitymolder
Copy link

no official workaround by the team until now?
same for other authed extensions

@Tnthr
Copy link

Tnthr commented Jul 22, 2024

After four hours of hacking on this I have a workaround. This is specifically for using git inside of the VSCode Flatpak. It does not seem to work for Github sign in or settings sync etc. I suspect that there is no write permission from inside the Flatpak container so those credentials will never be saved to the keyring.

I'm on Linux Mint which uses libsecret and Seahorse by default. The git credential helper program is by default: /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret When trying to git pull inside the Flatpak VSCode I would look at the output of Git and always see that the git-credential-libsecret access would fail with: /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret: No such file or directory

Flatpak by default does not allow direct access to the /usr directory. Flatpak - Sandbox Permissions Instead the /usr directory can be mounted under /run/host which seems to be the case with this VSCode. This explains the file not found error.

You could update git to point to /run/host/usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret for the credential.helper but this would prevent any other access to the helper program outside of flatpak.

What I did was copy the git-credential-libsecret program to my personal ~/bin directory and then updated the git config to point there instead. This should allow git to use the program even when outside of Flatpak. git config --global credential.helper /home/<username>/bin/git-credential-libsecret

Lastly open a terminal and navigate to any git directory that is linked to the server you use and git pull When you authenticate here it should be written to your keyring and then can be accessed by VSCode inside the Flatpak container.

Hope that helps someone. Cost me four hours and it's not a perfect solution. May still switch back to just manually downloading the official release.

@francoism90
Copy link

@Tnthr Couldn't you just include that bin in the flatpak? Maybe it is already provided by the flatpak manifest as dep.

@Tnthr
Copy link

Tnthr commented Jul 22, 2024

I’m sure you could but I’ve never worked with flatpak before so I don’t know how that would look without a bit more research.

My initial attempt to map the directory via cli options failed, I believe, because /usr is a reserved directory according to the flatpak reference linked above. But I didn’t dig much further or look into repackaging the entire program. The easier solution at the moment was to simply copy the bin to an accessible location.

The next problem would be to see the files that are modified by libsecret and give write access to those files. That, I think, might be the fix for this entire issue tho. But again more research is required to figure out how to allow that access inside the container and securely.

@tazihad
Copy link

tazihad commented Sep 28, 2024

I fixed the issue on Fedora 41 KDE 6.2 by following the guide.
~/.vscode/argv.json

{
  ...
  "password-store":"kwallet5"
  ...
}

flatpak permission:

flatpak override --user --talk-name=org.kde.kwalletd5 --talk-name=org.freedesktop.secrets com.visualstudio.code

These permission should be provided by default from the flathub manifest.

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