I am making a simple extension with react. But when running chrome.cookies.set, I get the following error:
{"domain":null,"expirationDate":2019035453.082,"firstPartyDomain":null,"httpOnly":null,"name":"token","partitionKey":null,"path":"/","sameSite":"no_restriction","secure":null,"storeId":null,"url":"http://localhost:3000","value":"test"}
My manifest.json includes all nessicary permissions according to the docs, so it’s strange that it isnt working. Everything works in chromium based browsers, not in firefox!.
{
"manifest_version": 3,
"name": "ext",
"description": "description",
"permissions": [
"tabs",
"cookies"
],
"action": {
"default_popup": "src/core/popup/index.html",
"default_icon": "icon-34.png"
},
"icons": {
"128": "icon-128.png"
},
"content_scripts": [],
"web_accessible_resources": [
{
"resources": [
"assets/js/*.js",
"assets/css/*.css",
"icon-128.png",
"icon-34.png"
],
"matches": [
"*://*/*"
]
}
],
"browser_specific_settings": {
"gecko": {
"id": "addon@domain.com"
}
},
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'"
},
"version": "1.0.0",
"host_permissions": [
"<all_urls>"
]
}
This is the react code that throws the error:
export const TestComponent = () => {
useEffect(() => {
(async () => {
await chrome.cookies.set({
url: "http://localhost:3000", // does not work with ex. https://example.com either
name: "token",
value: "thetoken",
path: "/",
});
})();
}, []);
return <></>;
}
I also want to note that chrome.cookies.get doesn’t work either, but it doesn’t even throw an error, just returns null