Marco Siegfried
Marco Siegfried

Reputation: 41

Proxy in Chrome Extension

I want to create a Chrome Extension wich changes the Proxy Settings of Chrome. Everything works correct but the problem is that i have to authenticate with username and password with the proxy.

Any idea how to do this ?

          var config = {
    mode: "fixed_servers",
    rules: {
      proxyForHttp: {
  scheme: "https",
  host: "209.164.75.72",
  port: 9786,
  username:'myusernmae',
  password:'proxypassword'

      },
      bypassList: ["foobar.com"]
    }
  };
  chrome.proxy.settings.set(
      {value: config, scope: 'regular'},
      function() {
    console.debug(chrome);    

          });

The above code doesnt work as seen here there are no valid documentation how to authenticate the proxy https://developer.chrome.com/extensions/proxy

Upvotes: 0

Views: 3591

Answers (1)

rsanchez
rsanchez

Reputation: 14657

You can listen for chrome.webRequest.onAuthRequired to provide the credentials when details.isProxy is true. You'll need the webRequest and webRequestBlocking permissions.

That's how Chrome-proxy-helper works.

Upvotes: 1

Related Questions