Reputation: 807
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
Reputation: 2168
In VS, click Sign In...
Login with- or pick a Microsoft Account (Yes! a Microsoft account)...
If it's your first time...
Go to signed in icon -> Add another account -> Choose Github.
else...
You may just need to re-authenticate.
After succesful github log in...
Output window should confirm you're good.
Upvotes: 0
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:
Open Visual Studio 2022 Preview.
Click on the "Team Explorer" tab on the right side of the window.
In the "Connect" section, click on "Manage Connections".
In the "Manage Connections" window, click on the "GitHub" option.
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:
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
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:
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
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:
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
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