由于我在axios中设置了 withCredentials: false,导致cookie携带不了。
解决方案:在Electron的BrowserWindow模块中配置这样一个参数:
webPreferences: {webSecurity: false},
webSecurity Boolean (可选) - 当设置为 false, 它将禁用同源策略 (通常用来测试网站), 如果此选项不是由开发者设置的,还会把 allowRunningInsecureContent设置为 true. 默认值为 true。
allowRunningInsecureContent Boolean (可选) -允许一个 https 页面运行 http url 里的资源,包括 JavaScript, CSS 或 plugins. 默认值为 false.
网友评论