简体   繁体   English

清单 v3 代理身份验证

[英]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?新的清单 v3 带来了webRequestwebRequestBlocking的厄运,我们应该如何验证代理请求?

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.文档说webRequestdeclarativeNetRequest取代,但他们没有提供一个如何执行此操作的示例。 Manifest v3 looks like is broken and google developers don't care anymore: Manifest v3 看起来已经损坏,谷歌开发人员不再关心:

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

You need to add in your manifest.json the webRequestAuthProvider permission.您需要在manifest.json中添加webRequestAuthProvider权限。

{
    "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"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM