I try to make a proxy in the Chrome extension, proxy is working connecting and all is good. But I need to manually enter auth credentials for proxy connection.
I’m trying to use webRequest
and webRequestAuthProvider
to automatically apply proxy auth credentials when it is required
let authListener = function(details, callbackFn) {
console.log('Auth required for', details.url);
callbackFn({
authCredentials: {
username: 'username',
password: 'pass',
}
});
}
chrome.webRequest.onAuthRequired.addListener(
authListener,
{ urls: ["<all_urls>"] }
['asyncBlocking']
);
When proxy auth block popups in the browser, chrome.webRequest.onAuthRequired
never being triggered, but, for example, chrome.webRequest.onBeforeRequest
or chrome.webRequest.onCompleted
are triggered correctly
"permissions": ["storage", "alarms", "tabs", "proxy", "webRequest", "webRequestAuthProvider"],
export function proxyConnect(proxy, scheme = 'http') {
chrome.proxy.settings.set(
{
value: {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme,
host: proxy.host,
port: proxy.port
},
bypassList: ['https://2ip.io'] // "<all_urls>"
}
},
scope: 'regular'
},
);
}