Set Multiple Cookies Before Browser Windows Loads URL


#1

Hey Everyone,

Im looking to inject some cookies that I have in a local storage file in one of my browser windows before the app begins. My final goal is to be able to save user name and password so the user doesn’t have to keep entering their credentials when the app is opened.
I set the the cookies into a string and have been trying to use WebContents.session.cookies.set.
This is what my code looks like:

var setCookie= fs.readFileSync('path_for_stored_cookies').toString().split("\n");
    spWindow.webContents.session.cookies.set({setCookie}, function(error, cookies){
      if (error) throw error;
    });

Any help would be greatly appreciated! Thanks in advance

-Alec