How to get Electron cookies in Angular js



I am just creating an Electron app and I have created cookies in my main.js (node js). session.fromPartition('persist:sessionName').cookies
Using this i can set and get cookies data, I want to manage these cookies on Angular JS.

Please advice.


You should be able to attach that data to a global variable in your main.js and access it with the remote package.

In main.js

global.cookies = whateverFunctionFetchesAndReturnsCookies();

And then in your angularApp.js

const remote = require('electron').remote;
const cookies = remote.getGlobal('cookies');


Yes i create this way @riebschlager

var expiration = new Date();
var hour = expiration.getHours();
hour = hour + 12;
var Cook = {
“url”: “http://localhosts/”,
“expirationDate”: expiration.getTime()
win.webContents.session.cookies.set(Cook,function(error) {
if (error) {

Is correct?