I am trying to set cookies using a chrome extension, to do this, I am fetching data from a URL looping through the data, and setting each as a cookie but I am getting the error: Error in invocation of cookies.set(object details, optional function callback): Error at parameter 'details': Unexpected property: 'session'.. The problem is with hostOnly, session, and id. When I remove them, the error is solved, but I need them so I can't do away with them.
[
{domain: ".example.com"
expirationDate: 1631030158.496085
hostOnly: false
httpOnly: true
id: 1
name: "__cd_bm"
path: "/"
sameSite: "no_restriction"
secure: true
session: false
storeId: "1"
value: "some value
},
{...},
{...},
{...},
{...}
]
fetch("https://somedomain/api/cookies")
.then((response) => response.json())
.then((data) => {
console.log(data)
for (let kuki of data) {
chrome.cookies.set({
url: kuki.domain,
name: kuki.name,
value: kuki.value,
httpOnly: kuki.httpOnly,
path: kuki.path,
secure: kuki.secure,
storeId: kuki.storeId,
sameSite: kuki.sameSite,
session:kuki.session,
expirationDate:kuki.expirationDate,
hostOnly:kuki.hostOnly,
id:kuki.id
});
}
console.log("Cookies set successfully!")
})
.catch((err) => console.error(err));
"permissions": [
"<all_urls>",
"webRequest",
"storage",
"webRequestBlocking",
"tabs",
"activeTab",
"proxy",
"cookies",
"management",
"http://*/*",
"https://*/*"
],
anyone can figure out the solution, please post