I’m struggeling a bit trying to get PlatformIO working behind my corporate proxy. VSCode grabs the Proxy-settings from the wpad-config in Windows (10) and asks me for credentials on startup. That way I was able to download PIO from the extension manager.
The first problem arose as VSCode was not able to download cpptools automatically, so i downloaded the *.vsix manually. Then I had to manually setup the virtual python environment.
PIO is working now but is blocked by the proxy. I can’t download libaries and if I want to create a new project the board drop-down menu stays empty (0 available). Setting the environment variables HTTP_PROXY and HTTPS_PROXY didn’t help.
Yes, the PIO IDE Terminal shows the environment variables values after a restart if I query them like that.
I tried setting the variables with and without my credentials, both variants didn’t enable PIO IDE to connect to the internet.
Giving the proxy-settings to pip in a similar form --proxy="http://<username>:<password>@proxy.hs-karlsruhe.de" works to download python packages.
I tried to use the request-package in python like suggested on your link which resulted in an error:
requests.exceptions.ProxyError: HTTPSConnectionPool(host=‘proxy.hs-karlsruhe.de’, port=8888): Max retries exceeded with url: http://example.org/ (Caused by ProxyError(‘Cannot connect to proxy.’, error(‘Tunnel connection failed: 403 Forbidden’,)))
EDIT: I fixed it http://<username>:<password>@proxy.hs-karlsruhe.de:8888/
Environment variable has to be formated exactly that way. I never thought the last slash could be important…
At the moment VSCode seems to grab the proxy-settings defined in my windows-settings. There I listed the path to a wpad.dat script that sets up the proxy. Everytime I start up VSCode I get a prompt to input my credentials (as shown in the VSCode-docs you linked). There it says the proxy is at port 8010 and not 8888. Port 8010 is the one defined on the wpad so I know VSCode is using that instead of the environment variables where i used 8888. Wierdly I get that exact same prompt a second time when the PIO Home Tab is loading in, altrough PIO doesn’t seem to use it.
If I delete the wpad-path in the windows-settings leaving the environment variables the only thing defining the proxy VSCode can’t connect to the internet anymore (can’t download extensions i.e.). Doing so will still result in PIO beeing able to connect to the internet…
Something else I tried was to set "http.proxyAuthorization" and "http.proxy" in the VSCode settings.json, but I could not get a working connection that way for neither VSCode nor the PIO IDE.
In the VSCode settings.json it says
// The value to send as the 'Proxy-Authorization' header for every network request.
// The proxy setting to use. If not set will be taken from the http_proxy and https_proxy environment variables.
I think the problem is, that PIO needs to have the credentials/authentification in the environmental variables itself while VSCode just wants the address in the variable and the credentials seperatly.
there I listed the address to the setup-script provided by out University IT-department. If “automatically detect settings” is activated it should be found automatically by the computer in the intranet (to my understanding), but that doesn’t work on some computers so you have to input it manually.
The file should be downloadable from anywhere if you want to take a look (wpad.dat).
Well, that’s the same way Firefox handles it (get a prompt there too every time I start it). And it feels better than having you credentials in your environmental variables in plain text.
I wonder if there is any news on this topic to securely set proxy credentials for platformio (maybe directly through pio, as using platformio through vscode might not be the only use case on a single machine).
For me, settings within vscode dont work (beside the fact that vscode itself works smoothly without additional settings as it uses windows settings).
But either option mentioned in FAQ: It’s truly not a valid option to store credentials as plain text, especially inside system variables where every program / virus / whatever has access to!
Please: Add a functionality to pio settings to securely store those credentials (encrypted). Or make it possible to use windows credentials. PlatformIO is a beautiful development tool, but this issue makes it difficult to “legally” use it in a corporate context
Thanks for the visual. Nice to have the official download.
I got it installed on cloud Gitpod, but presently it is not very active, I think I have to install the core as well. This is nothing to do with Platformio probably more to do with how gitpod/theia uses extensions.
Yeah, you need the core for the real functionality, the extension just provides the glue that integrates PIO into VSCode. Normally you’d restart VSCode after installing the extension, and the extension would then manage the install of PIO core, but I don’t know how/if you can do the same with gitpod/theia. Edit: Oh, I see you posted about Gitpod and PIO the other week, so yeah, it looks like you should be able to get it all working. or are at least pretty close!
Finally this works for me. Please, add this hint to the documentation you linked below. I think lots of people could run into this problem.
However it is not understandable for me, how one can implement such an user-unfriendly input mask.
Why not a input box for username, one for password, with automatic decoding of special chars.
And in general, I think it’s a no-go to store a password unencrypted in any ini file.
This really is not a professional solution. I hope the developers take care for a better solution in future.
I would prefer to get a message box requesting username and pw each time, instead of storing my credentials