Skip to content

Instantly share code, notes, and snippets.

@t57ser
Created October 22, 2021 09:00
Show Gist options
  • Save t57ser/a34dfe9579b856e6e765b59fb8d215cb to your computer and use it in GitHub Desktop.
Save t57ser/a34dfe9579b856e6e765b59fb8d215cb to your computer and use it in GitHub Desktop.
[Bug]: No longer possible to set insecure cookies
const electron = require("electron");
const { app, BrowserWindow } = require("electron");
const path = require("path");
function init() {
let browserWindow = new BrowserWindow({
show: true,
webPreferences: {
partition: "persist:test-2",
}
});
const session = electron.session.fromPartition("persist:test-2");
session.cookies.set({
name: "testcookie",
value: "testvalue",
domain: ".testdomain.com",
path: "/",
url: "http://testdomain.com",
}).then(() => {
console.log("setting cookie success");
}).catch((e) => {
console.error(e);
});
}
app.on("ready", () => {
init();
});
{
"main": "main.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "15.3.0"
},
"dependencies": {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment