How to specify user ID and password for Visual Studio code with authentication proxy?

How to specify user ID and password for Visual Studio code with authentication proxy?

I saw Proxy Server Support on the VS Code main site, but this only mentions two settings ...

"http.proxy": "http://10.203.0.1:5187/" "http.proxyStrictSSL": false 

I installed them, but still no luck, for example. I can’t install extensions ... I can’t even get a list of them

I suspect this is our proxy server, as it needs a user ID and password :-(

So how can you set these values?

+16
proxy visual-studio-code
source share
8 answers

Set the credentials inside the proxy address:

 http://username:password@10.203.0.1:5187/ 

A WARNING. Setting a plaintext password in a file may result in unauthorized access to your account. In addition, this may violate your company’s data security regulations. https://cwe.mitre.org/data/definitions/256.html

+25
source share

If you do not want to store your credentials in the settings file, the script can be used to proxy a proxy call. Moreover, I believe that the above only works for proxies that use basic authentication, the following should work for NTLM.

VSCode Open the settings file:

% APPDATA% \ Code \ User \ settings.json

add the following:

 { "http.proxy": "http://127.0.0.1:8888", "http.proxyStrictSSL": false } 

Fiddler Confirm script settings:

enter image description here enter image description here

Fiddler Verify that Fiddler is installed for automatic authentication:

enter image description here

VSCode Extensions Must Be Online:

enter image description here


Update

This is no longer required after implementing PR # 22369 , which was implemented in version 1.15 Proxy Authentication .

In my case, I still needed to add:

 "http.proxyStrictSSL": false 
+20
source share

My favorite answer here is David Martin's suggestion for using Fiddler. But if this is not what you want to do, the following describes how to set the credentials for the proxy server.

To specify DOMAIN + username + password: (Most likely, it will not work with a slash, so use% 5C instead of a slash, as shown below)

 // The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables "http.proxy": "http://DOMAIN%5Cusername:password@proxy_name_or_ip:port", "https.proxy": "http://DOMAIN%5Cusername:password@proxy_name_or_ip:port", // Whether the proxy server certificate should be verified against the list of supplied CAs. "http.proxyStrictSSL": false, 

To specify only username + password:

 // The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables "http.proxy": "http://username:password@proxy_name_or_ip:port", "https.proxy": "http://username:password@proxy_name_or_ip:port", // Whether the proxy server certificate should be verified against the list of supplied CAs. "http.proxyStrictSSL": false, 
+5
source share

Please refer to this article. https://taeguk.co.uk/blog/working-in-visual-studio-behind-the-firewall/

Suppose my NTLM login is DOMAIN \ User Name and my password is P @ssword! The credential format should be DOMAIN \ User Name: P @ssword !, but you need a URL. Encode username and password. A simple online URL can translate your username and password: DOMAIN% 5CUser% 20Name and P% 40ssword !. Put all this information in one line, for example: http: // DOMAIN% 5CUser% 20Name: P% 40ssword! @ Proxy-cluster.fqdn.local: 8881 Then add this to your user settings in the "File", "Preferences" against http.proxy values: // Put your settings in this file to overwrite the default settings {"http.proxy": " http: // DOMAIN% 5CUser% 20Name: P% 40ssword! @ proxy-cluster.fqdn. local: 8881 "}

+4
source share

"http.proxy": " http: // DOMAIN // USER: PASSWORD@wsg.test.com: 8080 ". Remember to add a port.

+2
source share

Honorable CNTLM can help you. You give him your credentials, tell him about the upstream proxy, run it on your local computer, and then point VS to the proxy at http: // localhost: 3128 .

http://cntlm.sourceforge.net/

This is a convenient solution for any application that does not support authenticated proxies.

+2
source share

in Visual Studio Code (my version 1.32.3) you write a request, i.e.

 ### my request GET https://defdomain.prefix.com/app/resource Authorization: bXl1c2VyOnVzZXIyMkBwYXNzd29yZA== 

Therefore, the authorization header is of type "Basic base64encoded" and consists of myuser: user22 @password (username: usercredentials) base64. It's all.

0
source share

Use the command below and replace the username, password and IP address of your proxy: port

PS C: \ Users \ rathakrishnan> npm configuration proxy http: // username: password@172.18.10.27: 3128

PS C: \ Users \ rathakrishnan> npm install -g @ angular / cli

0
source share

All Articles