I've got a Chrome Extension I am writing to emulate certain gui calls and automate them, everything is working as intended except that I cannot see any contents inside chrome.cookies
. I can get limited cookie data from document.cookie
but I need the chrome.cookies
extension options to emulate the session. Basically by default https://www.owasp.org/index.php/HttpOnly restricts that access (which is normally fine)
this is what I am trying to get at https://developer.chrome.com/extensions/cookies
In order to access chrome.cookies
I have altered my manifest.json:
{
"manifest_version": 2,
"name": "Call Builder",
"description": "This extension auto creates Dialog nodes",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "myPopup.html"
},
"permissions": ["cookies", "tabs", "*://*.mydomain.com/*"],
"content_scripts": [
{
"matches": ["*://*.mydomain.com/*"],
"js": ["router.js"]
}
]
}
note the line "permissions": ["cookies", "tabs", "*://*.mydomain.com/*"],
I know I've done the right thing with "cookies"
in "permissions"
but when I try to access chrome.cookies
(or any of it's methods) it is empty (undefined
) what is the reason?
EDIT
PLEASE READ MY COMMENT BELOW :-) this issue is a scoping issue and it's not documented nor covered - TLDR; while chrome.tabs
is available in both js spaces chrome.cookies
isn't and this isn't mentioned in the answer nor the chrome documentation