title: Cookies not saved in the browser
body: <p>I am trying to set a cookie in my browser using a Python Flask backend however, when we call the set cookie function I am unable to observe the cookie being saved by the browser. The following is my current understanding about how this is supposed to work:</p>
  
  <ul>
  <li>Cookies are just key value pairs that may have an expiration which makes them persistent, otherwise they expire when the browser is closed</li>
  <li>to set a cookie, all that is necessary is to use the set-cookie header in the response. I call the flask response object's set_cookie method to do this.</li>
  <li>the browser should automatically save the cookie and follow the expiration rules (the set_cookie header can be observed in the response received by the browser)</li>
  </ul>
  
  <p>Making the request in Angular HttpClient</p>
  
  <pre><code>let headers = new Headers();
  headers.append('Content-Type', 'application/json');
  let options = new RequestOptions({ headers: headers, withCredentials: true });
  const request_data = {'username': this.username, 'password': this.password};
  this.http.post('http://localhost:8080/token', request_data, options)
  </code></pre>
  
  <p>Setting the cookie in Python Flask</p>
  
  <pre><code>g.response = make_response()
  time = datetime.datetime.now() + datetime.timedelta(days=30)
  g.response.set_cookie("auth_token", auth.token, expires=time)
  return g.response
  </code></pre>
  
  <p>Plain text response in the browser</p>
  
  <pre><code>HTTP/1.1 200 OK
  set-cookie: auth_token=7253f2fa43d7584741dcf8972dea8f; Expires=Fri, 05-Jan-2018 01:33:30 GMT; Path=/
  vary: Origin
  access-control-allow-credentials: true
  access-control-allow-origin: http://127.0.0.1:4200
  content-type: application/json
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Cache-Control: no-cache
  Content-Length: 58
  Server: Development/2.0
  Date: Wed, 06 Dec 2017 01:33:30 GMT
  </code></pre>
  
  <p>Browser's cookies section
  <a href="https://i.stack.imgur.com/bBpWL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bBpWL.png" alt="screenshot of no cookies being saved"></a></p>
  
  <p>Other thoughts &amp; posts explored:</p>
  
  <ul>
  <li>Tried using both Safari and Chrome, and received the same result in both. I have also verified that cookies are allowed by the browser.</li>
  <li><a href="https://stackoverflow.com/questions/17064791/http-doesnt-send-cookie-in-requests">$http doesn&#39;t send cookie in Requests</a></li>
  <li><a href="https://stackoverflow.com/questions/31972753/cookie-is-not-set-in-browser">Cookie is not set in browser</a></li>
  <li><a href="https://stackoverflow.com/questions/2320110/how-do-i-set-a-cookie-header-with-xmlhttprequest-in-javascript/8530284#8530284">How do I SET a Cookie (header) with XMLHttpRequest in JavaScript?</a></li>
  </ul>
  
  <p>Question:</p>
  
  <p>How do I get the cookies to be saved by the browser so that it can be used in the current session?</p>