Chrome extension pass cookies from website to extension's localstorage

39 views
Skip to first unread message

Dean Van Greunen

unread,
Jul 15, 2021, 8:11:18 AM7/15/21
to Chromium Extensions

hrg...@gmail.com

unread,
Jul 15, 2021, 7:28:20 PM7/15/21
to Chromium Extensions, deanv...@gmail.com
You are sending a "getCookies" message from the popup to all active tabs.
But in content.js you are expecting a "setCookies" message and not a "getCookies" message, so nothing will happen.

After you fix that first problem, you also have to fix the "all active tabs" thing, which is probably not what you wanted.

Also,  you are not showing the content of the "getCookie" function. Who knows what's happening inside of that.


Dean Van Greunen

unread,
Jul 16, 2021, 4:18:16 AM7/16/21
to hrg...@gmail.com, Chromium Extensions

async function getCookie(domainname){
    console.log("loading cookie for: " + domain);
    return new Promise((resolvereject)=>{
        chrome.cookies.get({"url": domain"name": name}, function(cookie) {
            resolve(cookie.value);
        });
    });
}
--

Dean Van Greunen | Senior Software Engineer
LinkedIn: deanvangreunen



Reply all
Reply to author
Forward
0 new messages