Dr Phil
Dr Phil

Reputation: 807

visual studio: "invalid copilot token: missing token: 404"

I've been getting this error while trying to use github copilot in visual studio.

invalid copilot token: missing token: 404 auth status: notauthorized

Things I tried but didn't help - logging out / in; uninstall / reinstall extension(s).

Any ideas?

Upvotes: 10

Views: 13166

Answers (5)

tno2007
tno2007

Reputation: 2168

In VS, click Sign In...

enter image description here

Login with- or pick a Microsoft Account (Yes! a Microsoft account)...

sign in

If it's your first time...

Go to signed in icon -> Add another account -> Choose Github.

else...

You may just need to re-authenticate.

choose github sign in

After succesful github log in...

github sign-in success

Output window should confirm you're good.

enter image description here

Upvotes: 0

heroesch
heroesch

Reputation: 149

To get "Auth Status: OK" / "Successfully authorized GitHub Copilot", you might need to force Visual Studio 2022 Preview to prompt for a login to GitHub with your browser. Try following these steps:

  1. Open Visual Studio 2022 Preview.

  2. Click on the "Team Explorer" tab on the right side of the window.

  3. In the "Connect" section, click on "Manage Connections".

  4. In the "Manage Connections" window, click on the "GitHub" option.

  5. Visual Studio should prompt you to sign in to GitHub. If it doesn't, you can try the following steps to force the login prompt:

    • Close Visual Studio.
    • Open your web browser and navigate to the GitHub website (https://github.com).
    • Sign in to GitHub if you're not already signed in. Once signed in, keep the GitHub tab open.
    • Now, reopen Visual Studio 2022 Preview. Repeat steps 2-4 above.

Following these steps should force Visual Studio to prompt you to sign in to GitHub, allowing you to authenticate and access your GitHub repositories within Visual Studio and enable your active Copilot Subscription.

Upvotes: 0

Eyal Gerber
Eyal Gerber

Reputation: 1657

For me, there was no need to copy anything. Perhaps the process changed as of September 2023. But I also had this problem, and the issue was simply going to your user profile at the top right of the window in Visual Studio and then you will see a GitHub icon: enter image description here

I had next to the GitHub icon a link to re-authenticate with GitHub. I clicked it, a link opened in my browser, and I got authenticated, and all the problems went away.

Upvotes: 5

dopecello
dopecello

Reputation: 239

For those really looking for a basic answer, assuming you have a GitHub Copilot subscription and that you are signed into GitHub, check the following before going with the above answer.

there is an icon in the bottom left-hand side of the coding window. It looks like this:

Github copilot icon

Now, follow the steps to authenticate your account on Github.

Should work after that.

For those that need a detailed demonstration this YouTube video is a great resource

Upvotes: 12

Dr Phil
Dr Phil

Reputation: 807

Turned out to be a firewall issue. I couldn't find any documentation, but apparently the autopilot extension calls home on port 9354 (TCP).

The firewall set up here blocks traffic on outgoing ports by default, which is why the authentication was failing.

Upvotes: 0

Related Questions