[英]Electron cookies Error: Failed to get cookie domain
im new to electron and im trying to set cookies in my login page, but for some reason im getting an error.我是 electron 的新手,我试图在我的登录页面中设置 cookies,但由于某种原因,我遇到了错误。 If this error is about setting the domain, then how do I set the domain value?
如果此错误与设置域有关,那么如何设置域值? Im using localhost and oracle database.
我使用 localhost 和 oracle 数据库。
This is the error这是错误
'Uncaught (in promise) Error: Failed to get cookie domain'
In my loginPage.js在我的 loginPage.js
let remote = require('electron').remote;
let cName = "mName";//cookies name
session.defaultSession.cookies.set({name: cName ,value: row[0]},//row[0] is from the database
err => {
if(err) console.log("error:"+err);
});
Also, this app is going to be a offline app.此外,此应用程序将成为离线应用程序。 Hoping to get some help, thanks!
希望能得到一些帮助,谢谢!
According to Electron's documentation, when calling set method to set a cookie, url to associate the cookie with has to be set otherwise the promise gets rejected.根据 Electron 的文档,在调用 set 方法来设置 cookie 时,必须设置与 cookie 关联的 url ,否则 promise 会被拒绝。 In your case, domain has also to be set.
在您的情况下,还必须设置域。 Try to set domain as 'localhost' Electron's Cookies Set Method Documentation
尝试将域设置为 'localhost' Electron 的 Cookies 设置方法文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.