3

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.

4

1 Answer 1

3

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"
}
1
  • This appears to be the solution for Manifest v3. Setting host_permissions is also required. At least in my testing, webRequestAuthProvider works with "blocking" but not "asyncBlocking" Apr 12 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.