{"action":"created","issue":{"url":"https://api.github.com/repos/electron/electron/issues/9995","repository_url":"https://api.github.com/repos/electron/electron","labels_url":"https://api.github.com/repos/electron/electron/issues/9995/labels{/name}","comments_url":"https://api.github.com/repos/electron/electron/issues/9995/comments","events_url":"https://api.github.com/repos/electron/electron/issues/9995/events","html_url":"https://github.com/electron/electron/issues/9995","id":242598929,"node_id":"MDU6SXNzdWUyNDI1OTg5Mjk=","number":9995,"title":"Feature Request: Possibility to persist session cookies","user":{"login":"rophy","id":592046,"node_id":"MDQ6VXNlcjU5MjA0Ng==","avatar_url":"https://avatars3.githubusercontent.com/u/592046?v=4","gravatar_id":"","url":"https://api.github.com/users/rophy","html_url":"https://github.com/rophy","followers_url":"https://api.github.com/users/rophy/followers","following_url":"https://api.github.com/users/rophy/following{/other_user}","gists_url":"https://api.github.com/users/rophy/gists{/gist_id}","starred_url":"https://api.github.com/users/rophy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rophy/subscriptions","organizations_url":"https://api.github.com/users/rophy/orgs","repos_url":"https://api.github.com/users/rophy/repos","events_url":"https://api.github.com/users/rophy/events{/privacy}","received_events_url":"https://api.github.com/users/rophy/received_events","type":"User","site_admin":false},"labels":[{"id":97403549,"node_id":"MDU6TGFiZWw5NzQwMzU0OQ==","url":"https://api.github.com/repos/electron/electron/labels/platform/windows","name":"platform/windows","color":"c7def8","default":false},{"id":124107069,"node_id":"MDU6TGFiZWwxMjQxMDcwNjk=","url":"https://api.github.com/repos/electron/electron/labels/status/wontfix%20%F0%9F%9A%AB","name":"status/wontfix 🚫","color":"c2e0c6","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-07-13T06:31:42Z","updated_at":"2019-03-28T08:16:11Z","closed_at":"2018-09-24T05:06:13Z","author_association":"NONE","body":"* Electron version: 1.6.2\r\n* Operating system: win\r\n\r\n\r\nCurrently, if I close an electron app, all session cookies are lost. \r\nI'd like to have the possibility to keep session cookies.  I thought this can be done by using \"persist:\" partition, but it seems persistent partition has nothing to do with preserving session cookies.\r\n\r\n\r\nI tried these:\r\n\r\n1. Using partition\r\n```js\r\nnew BrowserWindow({\r\n  webPreferences: {\r\n    partition: 'persist:mywin'\r\n  }\r\n})\r\n```\r\n\r\n2. Using session with explicitly passed partition\r\n```js\r\nvar session = electron.session.fromPartition('persist:mywin');\r\n\r\nnew BrowserWindow({\r\n  webPreferences: {\r\n    session: session\r\n  }\r\n})\r\n\r\n```\r\n\r\nNote: \"session cookie\" are those with cookie.session = true. They're supposed to be cleared on closing browser, but sometimes it can be useful to keep session cookies. For example, Chrome's [Continue where you left off](https://support.google.com/chrome/answer/95314?hl=en).\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/electron/electron/issues/comments/477493499","html_url":"https://github.com/electron/electron/issues/9995#issuecomment-477493499","issue_url":"https://api.github.com/repos/electron/electron/issues/9995","id":477493499,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3NzQ5MzQ5OQ==","user":{"login":"twolfson","id":902488,"node_id":"MDQ6VXNlcjkwMjQ4OA==","avatar_url":"https://avatars3.githubusercontent.com/u/902488?v=4","gravatar_id":"","url":"https://api.github.com/users/twolfson","html_url":"https://github.com/twolfson","followers_url":"https://api.github.com/users/twolfson/followers","following_url":"https://api.github.com/users/twolfson/following{/other_user}","gists_url":"https://api.github.com/users/twolfson/gists{/gist_id}","starred_url":"https://api.github.com/users/twolfson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twolfson/subscriptions","organizations_url":"https://api.github.com/users/twolfson/orgs","repos_url":"https://api.github.com/users/twolfson/repos","events_url":"https://api.github.com/users/twolfson/events{/privacy}","received_events_url":"https://api.github.com/users/twolfson/received_events","type":"User","site_admin":false},"created_at":"2019-03-28T08:16:11Z","updated_at":"2019-03-28T08:16:11Z","author_association":"CONTRIBUTOR","body":"Corrections to the posted solutions: The ternary should only be for `cookie.secure`, not also `cookie.httpOnly` -- otherwise we will attempt to set `cookie.secure` on using a `http` URL which will fail\r\n\r\n```js\r\nvar url = util.format('%s://%s%s', cookie.secure ? 'https' : 'http', cookie.domain, cookie.path);\r\nvar url = `${cookie.secure ? 'https' : 'http'}://${cookie.domain}${cookie.path}`\r\n```"}}
{"actor":{"display_login":"twolfson"}}