AI and LLM integration · Decision guide
Copilot in VS Code is blocked by a proxy that wants a login
Short answer
HTTP 407 Proxy Authentication Required means the company proxy refused Copilot until it signs in. Copilot supports Basic and Kerberos proxy authentication only. Run GitHub's curl test to read the Proxy-Authenticate header, then add credentials to the proxy URL for Basic, or get a Kerberos ticket and the right SPN for Negotiate. Applies to VS Code 1.147.
HTTP 407 is a company proxy telling Copilot to sign in before it may reach GitHub. The proxy states which sign-in it will accept in the Proxy-Authenticate header, and Copilot in VS Code supports only two kinds: Basic and Kerberos. So the first move is to read that header and see which one your proxy asks for.
GitHub publishes a curl test for exactly this. Run it through your proxy, read the headers, then follow the matching case below. If curl succeeds and Copilot still fails, the cause is on the editor's side.
Find your case
- If the challenge is Proxy-Authenticate: BasicGive the proxy URL a user name and password.
- If the challenge is Proxy-Authenticate: NegotiateYou need a Kerberos ticket and the right service name.
- If curl returns 200 but Copilot still failsAn environment variable may point it at another proxy.
Read the proxy's challenge
Run GitHub's ping through the proxy. A 407 status means the client must authenticate; the Proxy-Authenticate line names the scheme.
Test the route Copilot uses
curl --verbose -x http://YOUR-PROXY-URL:PORT -i -L https://copilot-proxy.githubusercontent.com/_pingBasic credentials
GitHub states that Copilot for VS Code handles Basic authentication when the user name and password are part of the proxy URL. Put them in the proxy setting. GitHub also warns that this keeps the password as plain text in the editor's settings file, so use a dedicated proxy account if your company allows one.
Proxy setting, then confirm a 200 with the same credentials
// settings.json
"http.proxy": "http://USERNAME:PASSWORD@10.203.0.1:5187/"
curl -s -o /dev/null -w "%{http_code}\n" -x http://USERNAME:PASSWORD@YOUR-PROXY-URL:PORT https://copilot-proxy.githubusercontent.com/_pingReload the window afterwards. Proxy URLs that start with https:// are listed by GitHub as unsupported by Copilot, so write http://.
Kerberos ticket and SPN
Negotiate is the HTTP scheme that can carry Kerberos. For Copilot it needs a krb5 library on the machine and an active ticket for the proxy service. By default Copilot derives the service principal name from the proxy URL, so http://proxy.example.com:3128 becomes HTTP/proxy.example.com. If the proxy is registered under a different name, the derived one is wrong.
Get a ticket with kinit, or let your desktop sign-in create one. If the names differ, set the right one in VS Code settings or in the AGENT_KERBEROS_SERVICE_PRINCIPAL environment variable.
Check for a ticket, get one, override the SPN
klist
kinit your.name@EXAMPLE.COM
// settings.json
"http.proxyKerberosServicePrincipal": "HTTP/proxy-real-name.example.com"A stale proxy variable
Copilot reads a proxy URL from HTTPS_PROXY, https_proxy, HTTP_PROXY or http_proxy, in that order, and uses the first one it finds for both HTTP and HTTPS. A leftover value from an old network, or from a script, can send Copilot to a proxy that wants a login while your editor setting looks right.
Inspect, clear, restart VS Code from that shell
env | grep -i _proxy
unset HTTPS_PROXY https_proxy HTTP_PROXY http_proxy
code .Quit every VS Code window first, so the new environment is picked up.
Avoiding a repeat
If curl reaches the ping endpoint and Copilot reports certificate errors instead of 407, the proxy is inspecting TLS and you need to trust its certificate, which is a different problem.
- Ask the network team to register a proxy SPN that matches the hostname developers type.
- Keep proxy variables in one managed place such as a login script.
In short
- Read Proxy-Authenticate: Basic needs credentials in the URL, Negotiate needs Kerberos.
- Check the proxy environment variables when curl works and Copilot does not.
- Credentials in settings.json are stored in plain text.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.