Standard
Standard

Reputation: 1512

Chrome extension: "No permission for cookies at url"

I try to get Cookies from a special Website.

Manifest permissions:

"permissions": [
"tabs",
"*//*free-way.me",
"storage",
 "cookies"
],

And this is my popup.js:

function getCookies(domain, name) 
{
    chrome.cookies.get({"url": domain, "name": name}, function(cookie) {
        return cookie.value;

    });
}

var uid = getCookies("http://.free-way.me", "uid")     
var upw = getCookies("http://.free-way.me", "upw")     

document.getElementById("user").value = uid;
document.getElementById("pw").value = upw;

..but it's just telling me, that I'd no permissions:

cookies.get: No host permissions for cookies at url: "http://.free-way.me/".
at getCookies (chrome-extension://[...]/popup.js:19:24)
at chrome-extension://[...]/popup.js:25:13 

Can you tell me please my mistake I made?...It drives me cracy. Thank you!

Markus

Upvotes: 2

Views: 10130

Answers (2)

nuruddin mehedi
nuruddin mehedi

Reputation: 31

some change have been taken place in Manifest version 3 about host permission.In MV3, you'll need to specify host permissions separately from other permissions:

// Manifest V2
"permissions": [
  "tabs",
  "bookmarks",
  "http://www.blogger.com/",
],
"optional_permissions": [
  "*://*/*",
  "unlimitedStorage"
]

 // Manifest V3
"permissions": [
  "tabs",
  "bookmarks"
],
"optional_permissions": [
  "unlimitedStorage"
],
"host_permissions": [
  "http://www.blogger.com/",
  "*://*/*"
],

Upvotes: 3

apsillers
apsillers

Reputation: 115950

Your match pattern is malformed. You're missing a period after the asterisk in the host name:

"*//*.free-way.me"

If the host identifier has a *, it must either:

  • be the entire host identifier, or
  • be the first character of the host identifier and be followed immediately by a period.

Upvotes: 0

Related Questions