Pitaroiu Bogdan
Pitaroiu Bogdan

Reputation: 41

Manifest v3 Proxy Authentication

With the new manifest v3 came the doom of webRequest and webRequestBlocking, how are we suppose to authenticate a proxy request?

Old way:

chrome.webRequest.onAuthRequired.addListener(function(details, callbackFn) {
    callbackFn({
        authCredentials: { username: username, password: password }
    });
},{urls: ["<all_urls>"]},['asyncBlocking']);

So my question besides the one above is what is the new way of doing this? Docs say that webRequest is replaced by declarativeNetRequest, but they don't provide one single example of how to do this. Manifest v3 looks like is broken and google developers don't care anymore:

https://bugs.chromium.org/p/chromium/issues/detail?id=1135492.

Upvotes: 4

Views: 3522

Answers (1)

Renan Hartwig
Renan Hartwig

Reputation: 39

You need to add in your manifest.json the webRequestAuthProvider permission.

{
    "version": "1.0.0",
    "manifest_version": 3,
    "name": "Chrome Auth Proxy",
    "permissions": [
        "tabs",
        "unlimitedStorage",
        "storage",
        "webRequest",
        "webRequestAuthProvider"
    ],
    "host_permissions": [
        "<all_urls>"
    ],
    "background": {
        "service_worker": "background.js"
    },
    "minimum_chrome_version": "22.0.0"
}

Upvotes: 3

Related Questions