Mohamad FG
Mohamad FG

Reputation: 21

How authorization a proxy in chrome extension with mv3?

⚠ in MV2 we using (webRequest) for proxy authorization . and today some parts not working ! google chrome suggested that we use (declarativeNetRequest) in MV3

Now my question is How to work with it ? ( for proxy authorization )

Google chrome still gives me sign in alert

My code is :

manifest.json

    {
  "name": "Test",
  "version": "1.0.0",
  "description": "Test",
  "manifest_version": 3,
  "declarative_net_request": {
    "rule_resources": [
      {
        "id": "ruleset_1",
        "enabled": true,
        "path": "rules.json"
      }
    ]
  },
  "permissions": [
    "proxy",
    "declarativeNetRequest",
    "declarativeNetRequestWithHostAccess",
    "declarativeNetRequestFeedback"
  ],
  "host_permissions": [
    "<all_urls>"
  ],
  "background": {
    "service_worker": "background.js",
    "type": "module"
  },
  "action": {
    "default_popup": "popup.html",
    "default_icon": {
      "128": "./icon/128.png",
      "48": "./icon/48.png",
      "32": "./icon/32.png",
      "16": "./icon/16.png"
    }
  },
}

rules.json

[
  {
    "id": 1,
    "priority": 1,
    "action": {
      "type": "modifyHeaders",
      "responseHeaders": [
        {
          "header": "Proxy-Authenticate",
          "operation": "set",
          "value": "Basic freeuser1:freeuser1"
        }
      ]
    },
    "condition": {
      "resourceTypes": [
        "main_frame"
      ]
    }
  }
]

Upvotes: 2

Views: 1135

Answers (1)

Jakob
Jakob

Reputation: 121

I guess Google forgot about proxy authentication for Manifest V3. Check this issue for potential updates. Developers of proxy extensions with millions of users are gathering in that thread trying to get an update. It's sad.

Upvotes: 1

Related Questions