简体   繁体   English

Electron cookies 错误:无法获取 cookie 域

[英]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.

相关问题 为什么会出现此错误:“无法在设计时启动域操作?” - Why do I get this error : “Domain operations cannot be started at design time?” ADFS错误-域名更改 - ADFS error - domain name change 在 ASP.Net 中,我有时会收到以下错误 - Viewstate 验证失败。 原因:视图状态提供的完整性检查失败 - In ASP.Net, I sometimes get the following error - Viewstate verification failed. Reason: The viewstate supplied failed integrity check 错误:应用程序注册失败 - Error: Registration of the app failed 错误:使用邮递员的get语句为“ http:// localhost:9000 / Product”,无法连接到***-getaddrinfo ENOTFOUND - error: “Failed to connect to *** - getaddrinfo ENOTFOUND” using postman with a get statement of “http://localhost:9000/Product” 我得到“构建失败”。 我在 Package 管理器控制台上写的任何东西都出错,没有任何其他解释 - I get "Build failed." error for anything I write on Package Manager Console without any other explanation 关机失败,错误10038 - Shutdown failed with error 10038 如何在没有Web服务器的情况下使Cookies工作? - How can I get make cookies work without webserver? 创建虚拟目录失败并显示错误 - Creating a virtual directory failed with the error 错误:程序包的SetSite失败[ApacheCordovaToolsPackage] - Error: SetSite failed for package [ApacheCordovaToolsPackage]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM