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

Copilot failing to connect in VS Codium #1388

Closed
DjSapsan opened this issue Jan 25, 2023 · 40 comments
Closed

Copilot failing to connect in VS Codium #1388

DjSapsan opened this issue Jan 25, 2023 · 40 comments
Labels
bug Something isn't working stale

Comments

@DjSapsan
Copy link

Hi. I just got Copilot and trying to use it in VS Codium. It is not available in the store so I downloaded and installed .VSIX file. Other extensions installed in this way are working perfectly fine, excep Copilot.
The error I have:

Invalid copilot token: missing token: 404
GitHub Copilot could not connect to server. Extension activation failed: "User not authorized"
And a pop-up
Screenshot_20230125_232320

@DjSapsan DjSapsan added the bug Something isn't working label Jan 25, 2023
@lyrek
Copy link

lyrek commented Jan 30, 2023

There is a tutorial here on how to get GitHub Copilot to work in VSCodium. Let me know if you get it working as I'm also interested in using Copilot in VSCodium!
https://prose.bentopais.pt/vscodium-and-copilot

@zeronyk
Copy link

zeronyk commented Feb 2, 2023

Worked for me!

Thank you so much for this Link, just sad that it does not show up on the first google entry when you type "vscode github-copilot"

@StitiFatah
Copy link

StitiFatah commented Feb 12, 2023

There is a tutorial here on how to get GitHub Copilot to work in VSCodium. Let me know if you get it working as I'm also interested in using Copilot in VSCodium!
https://prose.bentopais.pt/vscodium-and-copilot

I can confirm it works, you have to install vscode first tho, and I personally didn't find the same snippet, I console.logged t.token and r.token from similar looking ones to get the needed token.

@EricBoily
Copy link

I agree with @StitiFatah, It works with his tweak. The search I used is {headers:{Authorization:token ${t.token}, then I found the next; (couple line below) and then added theconsole.log(t.token);`

@rafek1241
Copy link

This approach is no longer valid as the VSCODE in latest version use github authentication instead

@gdinh
Copy link

gdinh commented Mar 22, 2023

Current error I'm getting is 'token not found'. Looking at the files mentioned in the articles above, the lines mentioned in the article have changed from:

{headers:{Authorization:`token ${t}`}});

to:

{headers:{Authorization:`token ${t.token}`,...(0,i.editorVersionHeaders)(e)}}

I know very little about js, but it seems like this is related to a change in how tokens are stored in the keychain.

I looked at keychain access on my mac, and the vscodiumvscode.github-authentication looks like:

{"extensionId":"vscode.github-authentication","content":"[{\"id\":\"0123456789abcdef\",\"accessToken\":\"ghp_pastedPATtokenalphanumericstring\",\"account\":{\"label\":\"gdinh\",\"id\":12345678},\"scopes\":[\"user:email\"]}]"}

whereas vscodevscode.github-authentication is a long alphanumeric string (letters, numbers, /, +, and = characters); not sure how it's encoded. Not sure if this is the issue; hopefully someone with a better understanding of the VSCod(ium) auth system can comment.

Has anybody tried to use an older version of the extension to see if the authentication issue related to the extension version or the codium version?

@jmainhard
Copy link

to:

{headers:{Authorization:`token ${t.token}`,...(0,i.editorVersionHeaders)(e)}}

I know very little about js, but it seems like this is related to a change in how tokens are stored in the keychain.

I managed to get the token (and connect Copilot) adding the console.log a little before, just at the start of the try
Search for the corresponding try and add this:

try{console.log(t); return await e.get(a.Fetcher).fetch(n,{headers:{Authorization:`token ${t.token}`,...(0,i.editorVersionHeaders)(e)}})}catch(t){throw e.get(o.UserErrorNotifier).notifyUser(e,t),t}}(e,t);

You also could add it as a new statement just like @EricBoily mentions before

I agree with @StitiFatah, It works with his tweak. The search I used is {headers:{Authorization:token ${t.token}, then I found the next; (couple line below) and then added theconsole.log(t.token);`

For example:

catch(t){throw e.get(o.UserErrorNotifier).notifyUser(e,t),t}}(e,t); console.log(t); // [...]

@gebeer
Copy link

gebeer commented Apr 3, 2023

Is there any chance that vscodium will get out of the box support for copilot? It seems like the hacks mentioned might only work temporarily.

@stdedos
Copy link

stdedos commented Apr 12, 2023

Is there a way to remove the token I have entered before?

Seems that there's no option to "re-authenticate"
image

The token is not in "plain settings"

and, Developer: Reinstall Extension does not work, since GHC is not a Marketplace extension 😖
image

@jmainhard
Copy link

jmainhard commented Apr 12, 2023

Is there a way to remove the token I have entered before?

Seems that there's no option to "re-authenticate" image

The token is not in "plain settings"

and, Developer: Reinstall Extension does not work, since GHC is not a Marketplace extension confounded image

(I don't know about Windows) With Gnome Keyring you could delete the token like this, I'm using Seahorse:

image

@daiyam
Copy link
Member

daiyam commented Apr 12, 2023

@stdedos You should be able to see this:
Screen Shot 2023-04-12 at 4 09 08 PM

@stdedos
Copy link

stdedos commented Apr 13, 2023

Yes, that's visible too. "But how could I know, I've never needed that". (Usually all actions are in the Command Palette 😅)

@wleoncio
Copy link

Finally got it working first by deleting my key (thanks @jmainhard!), then using the token generated by the MS-tainted VSCode installation (see #1388 (comment), props to @jmainhard again).

With the ChatGPT extension and GH Copilot in place, I just need to quit my habit of opening a browser and searching for help with my coding. 😅

@charalamm
Copy link

For those trying to find the Check vscode's logs (help > developer tools > console); in VSCode:

  • Open the developer tools from Help > Toggle Developer Tools
  • Go to the Console tab
  • Find the [Extension Host]%> Object and click it to expand it and the token will be there

@StitiFatah
Copy link

StitiFatah commented Apr 17, 2023

I got disconnected and it wasn't even after a system update, it becomes annoying to download VScode for this, basically is it a thing vscodium would need to explicitly support for it to work normally or is this just Microsoft going back to the good ol' days ?

I'm considering switching back to Neovim tbh.

With the ChatGPT extension and GH Copilot in place, I just need to quit my habit of opening a browser and searching for help with my coding. sweat_smile
jmainhard reacted with rocket emoji

Is the chatgpt extension (if yes which one ?) doing anything more than providing the same GUI as the official one but in the editor ? Otherwise there are plenty of CLI clients to avoid having to use a browser. I'm currently using https://github.com/sigoden/aichat

@wleoncio
Copy link

Is the chatgpt extension (if yes which one ?) doing anything more than providing the same GUI as the official one but in the editor ? Otherwise there are plenty of CLI clients to avoid having to use a browser. I'm currently using https://github.com/sigoden/aichat

A CLI solution is interesting for off-VSC activity, but since most of my coding happens in there, I use the ChatGPT - Genie AI extension, which is nicely integrated into the editor.

@StitiFatah
Copy link

Is the chatgpt extension (if yes which one ?) doing anything more than providing the same GUI as the official one but in the editor ? Otherwise there are plenty of CLI clients to avoid having to use a browser. I'm currently using https://github.com/sigoden/aichat

A CLI solution is interesting for off-VSC activity, but since most of my coding happens in there, I use the ChatGPT - Genie AI extension, which is nicely integrated into the editor.

Does it interact directly with your code (maybe by selecting it then opening a pop up window with the code already in the prompt) ? If yes might be interesting, otherwise Vsc has an integrated terminal too

@wleoncio
Copy link

Does it interact directly with your code (maybe by selecting it then opening a pop up window with the code already in the prompt) ?

Yes, it does. Here's a list of commands:

image

And some buttons to paste generated code from the chat window into the editor:

image

@StitiFatah
Copy link

Does it interact directly with your code (maybe by selecting it then opening a pop up window with the code already in the prompt) ?

Yes, it does. Here's a list of commands:

image

And some buttons to paste generated code from the chat window into the editor:

image

Thanks, seems cool

@wleoncio
Copy link

is it a thing vscodium would need to explicitly support for it to work normally

I think it's technically possible for VSCodium to support Copilot without all this hacking. Copilot worked out-of-the-box on my Arch laptop running Code - OSS, so perhaps all VSCodium would need to do is to change something on their build script.

Given how relevant Copilot has become, perhaps the VSCodium distributors should make their support plans explicit on the VSCodium main page: if there are no plans to change the build scripts to support Copilot (perhaps it would involve allowing some nasty MS telemetry in), potential users should be advised to build VSC from source themselves.

@gebeer
Copy link

gebeer commented Apr 18, 2023

is it a thing vscodium would need to explicitly support for it to work normally

I think it's technically possible for VSCodium to support Copilot without all this hacking. Copilot worked out-of-the-box on my Arch laptop running Code - OSS, so perhaps all VSCodium would need to do is to change something on their build script.

Given how relevant Copilot has become, perhaps the VSCodium distributors should make their support plans explicit on the VSCodium main page: if there are no plans to change the build scripts to support Copilot (perhaps it would involve allowing some nasty MS telemetry in), potential users should be advised to build VSC from source themselves.

Exactly. Given the popularity of Copilot, the vscodium maintainers should really address this asap.

@StitiFatah
Copy link

StitiFatah commented Apr 18, 2023

Thanks for letting me know, I'm on Arch too and just installed code, it's working fine but I had to to run it via code --enable-proposed-api GitHub.copilot

Unfortunately code isn't the same as vscodium privacy wise.

Given how relevant Copilot has become, perhaps the VSCodium distributors should make their support plans explicit on the VSCodium main page: if there are no plans to change the build scripts to support Copilot (perhaps it would involve allowing some nasty MS telemetry in), potential users should be advised to build VSC from source themselves.

Yes probably, they inform about the marketplace issue and the workaround so why not

@daiyam
Copy link
Member

daiyam commented Apr 18, 2023

Feel free to make a PR to fix any issue 😉

@daiyam
Copy link
Member

daiyam commented Apr 18, 2023

About extensionEnabledApiProposals, VSCodium should be the same as VSCode since we are copying it directly from its archive (https://github.com/VSCodium/vscodium/blob/master/build/update_api.sh)

AUR Code uses the protocol vscode which helps to be more compatible with a normal VSCode (and with its name, since some extensions are checking the editor name) but becomes incompatible with VSCode since they are using the same protocol...
VSCodium use the protocal vscodium so both editors can run on the same machine.

All is about how to the authentication, by default, VSCode calls a web service on github which reply with an url with vscode as the protocol. We tried to pass the return url, does change it. So we decided to scrap the whole process and to go directly to PAT.

@Aspyryan
Copy link

But PAT tokens seem to always fail for me, it still says user not authenticated even when I am correctly signed in and have access to copilot!

@StitiFatah
Copy link

StitiFatah commented Apr 20, 2023

But PAT tokens seem to always fail for me, it still says user not authenticated even when I am correctly signed in and have access to copilot!

Just retried yesterday and it worked fine, it wasn't working at first although I got the token but then I updated copilot on both Vscode and Vscodium and it fixed it, maybe make sure you have the same version in both.

@daiyam
Copy link
Member

daiyam commented Apr 20, 2023

@Aspyryan Have you followed #1487?

@Aspyryan
Copy link

@Aspyryan Have you followed #1487?

Thanks, this worked!

@jeremiah-k
Copy link

I was able to get my token, thank you for that. But where do I re-enter it? I can't find anywhere in extension settings, I've uninstalled/reinstalled the extension, etc.

@StitiFatah
Copy link

StitiFatah commented Apr 22, 2023

I was able to get my token, thank you for that. But where do I re-enter it? I can't find anywhere in extension settings, I've uninstalled/reinstalled the extension, etc.

(On vscodium) When you have copilot and you aren't logged in you have a pop-up in the bottom right corner asking you to connect, you click on "connect", it'll then redirect you to your browser, you ignore that since you already have your token, you'll then have an input box in the top asking you for your token and just past it here.

@jeremiah-k
Copy link

I was able to get my token, thank you for that. But where do I re-enter it? I can't find anywhere in extension settings, I've uninstalled/reinstalled the extension, etc.

(On vscodium) When you have copilot and you aren't logged in you have a pop-up in the bottom right corner asking you to connect, you click on "connect", it'll then redirect you to your browser, you ignore that since you already have your token, you'll then have an input box in the top asking you for your token and just past it here.

Ok, I'm getting a different message in the Output tab. It's no longer saying that I don't have access, it's saying:
[INFO] [copilotIgnore] [2023-04-22T06:32:47.367Z] inactive

Do I still have to activate it somewhere else?

@StitiFatah
Copy link

I was able to get my token, thank you for that. But where do I re-enter it? I can't find anywhere in extension settings, I've uninstalled/reinstalled the extension, etc.

(On vscodium) When you have copilot and you aren't logged in you have a pop-up in the bottom right corner asking you to connect, you click on "connect", it'll then redirect you to your browser, you ignore that since you already have your token, you'll then have an input box in the top asking you for your token and just past it here.

Ok, I'm getting a different message in the Output tab. It's no longer saying that I don't have access, it's saying:
[INFO] [copilotIgnore] [2023-04-22T06:32:47.367Z] inactive

Do I still have to activate it somewhere else?

You got that after you pasted the token in the input form of vscodium ?

@jeremiah-k
Copy link

jeremiah-k commented Apr 22, 2023

You got that after you pasted the token in the input form of vscodium ?

Yes.

@StitiFatah
Copy link

Yes

I was able to get my token, thank you for that. But where do I re-enter it? I can't find anywhere in extension settings, I've uninstalled/reinstalled the extension, etc.

(On vscodium) When you have copilot and you aren't logged in you have a pop-up in the bottom right corner asking you to connect, you click on "connect", it'll then redirect you to your browser, you ignore that since you already have your token, you'll then have an input box in the top asking you for your token and just past it here.

Ok, I'm getting a different message in the Output tab. It's no longer saying that I don't have access, it's saying:
[INFO] [copilotIgnore] [2023-04-22T06:32:47.367Z] inactive
Do I still have to activate it somewhere else?

You got that after you pasted the token in the input form of vscodium ?

Yes.

Be sure your vscodium and Vscode version of copilot are both up to date, I had an error 2 days ago because of that

@jeremiah-k
Copy link

jeremiah-k commented Apr 22, 2023

Be sure your vscodium and Vscode version of copilot are both up to date, I had an error 2 days ago because of that

This is my first time trying Copilot, so I wasn't sure what to expect. I'm using version 1.83.41 downloaded fresh from https://marketplace.visualstudio.com/items?itemName=GitHub.copilot

I followed the instructions in #1487

VSCODIUM_FOLDER/resources/app/product.json is still modified, if that makes a difference. Other than that everything the way that it was shipped and it's up to date.

Edit: I'm using Codium Insiders - 1.78.0-insider

Edit again: I think it's working even though it was displaying that message. Thanks for the help.

@StitiFatah
Copy link

Be sure your vscodium and Vscode version of copilot are both up to date, I had an error 2 days ago because of that

This is my first time trying Copilot, so I wasn't sure what to expect. I'm using version 1.83.41 downloaded fresh from https://marketplace.visualstudio.com/items?itemName=GitHub.copilot

I followed the instructions in #1487

VSCODIUM_FOLDER/resources/app/product.json is still modified, if that makes a difference. Other than that everything the way that it was shipped and it's up to date.

Edit: I'm using Codium Insiders - 1.78.0-insider

I haven't used the #1487 method to get the token, I got it from MS Vscode, don't know if there's any difference.

And I'm not using vscodium-insiders but the regular version from the AUR.

My products.json is also modified to get the official marketplace.

If it can help.

@psipherious
Copy link

I followed the method at #1487 as well and it worked perfectly for connecting VS Codium without the need to do anything in VS Code.

I did this on Windows myself and initially had an issue in both Command Prompt & Powershell with curl errors.

Ended up resolving that problem by simply using the MING64 based Git Bash as part of the Git Windows package found at:
https://git-scm.com/

@CedHild
Copy link

CedHild commented May 25, 2023

Is there a way to remove the token I have entered before?
Seems that there's no option to "re-authenticate" image
The token is not in "plain settings"
and, Developer: Reinstall Extension does not work, since GHC is not a Marketplace extension confounded image

(I don't know about Windows) With Gnome Keyring you could delete the token like this, I'm using Seahorse:

image

On windows, the key can be deleted in the windows "Credential Manager". this logs out the user too.

Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment, and we'll keep it open. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the stale label Nov 22, 2023
Copy link

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue, please open a new issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests