<ul dir="auto">
<li>Electron version: 1.4</li>
<li>Operating system: windows</li>
</ul>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">After taking from cookies.get I should be able to use the same output to cookies.set</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">Error: Setting cookie failed<br>
at Error (native)</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">When a browser window closes I want to nab it's cookies and store them. I don't want to use your system because the user might want to export the cookies and use them on another machine. I'm developing something to allow people to browse on multiple machines using the same cookies.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
function ChildBrowserClose(e) {
console.log(e.sender);
    e
        .sender
        .webContents
        .session
        .cookies
        .get({}, (error, cookies) =&gt; {
            e.sender.CustomSession.Cookies = JSON.stringify(cookies);
            var Sessions = app
                .Session
                .get('Sessions')
            Sessions
                .find({id: e.sender.CustomSession.id})
                .assign(e.sender.CustomSession)
                .value()
            console.log(error, cookies)
        });

}"><pre class="notranslate"><code class="notranslate">
function ChildBrowserClose(e) {
console.log(e.sender);
    e
        .sender
        .webContents
        .session
        .cookies
        .get({}, (error, cookies) =&gt; {
            e.sender.CustomSession.Cookies = JSON.stringify(cookies);
            var Sessions = app
                .Session
                .get('Sessions')
            Sessions
                .find({id: e.sender.CustomSession.id})
                .assign(e.sender.CustomSession)
                .value()
            console.log(error, cookies)
        });

}
</code></pre></div>
<hr>
<p dir="auto">later I try to set with</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  for(var i=0;i&lt;Cookies.length;i++){ 
            NewBrowser
                .webContents
                .session
                .cookies
                .set(Cookies[i], (error) =&gt; {
                    console.log(error);
                });
            }"><pre class="notranslate"><code class="notranslate">  for(var i=0;i&lt;Cookies.length;i++){ 
            NewBrowser
                .webContents
                .session
                .cookies
                .set(Cookies[i], (error) =&gt; {
                    console.log(error);
                });
            }
</code></pre></div>
<p dir="auto">Error: Setting cookie failed<br>
at Error (native)</p>
<p dir="auto">None of the cookies I am saving from my session have a <code class="notranslate">url</code> property. However, when I call <code class="notranslate">win.webContents.session.cookie.set(cookie, cb)</code> I get an error cause the cookie I am trying to set doesn't have a <code class="notranslate">url</code> property. If they cookie didn't have a url on it when I called <code class="notranslate">win.webContents.session.cookies.get()</code>, then electron shouldn't require me to have a <code class="notranslate">url</code> property on the cookie to set it.</p>