visual studio: "invalid copilot token: missing token: 404"
Asked Answered
F

5

9

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?

Flew answered 25/7, 2023 at 17:45 Comment(0)
K
11

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

Keese answered 10/8, 2023 at 21:3 Comment(0)
N
5

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.

Newborn answered 28/9, 2023 at 5:35 Comment(2)
When I do that it sends me to a localhost address, which makes no sense at all.Candie
@DanielWilliams It is supposed to do that. Just wait a moment and go back to Visual Studio and you will see that you are now authenticated with GitHub.Newborn
F
0

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.

Flew answered 25/7, 2023 at 17:45 Comment(0)
H
0

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.

Hurlbut answered 24/2, 2024 at 0:20 Comment(0)
C
0

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

Ceruse answered 10/4, 2024 at 12:31 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.