title: Manage token life duration with SimpleCookie in Python
body: <p>Already got token working correctly, which is set this way:</p>
  
  <pre><code>session_cookie = SimpleCookie()
  session_cookie['key'] = any_string_value
  session_cookie['key']["Path"] = '/'
  
  headers = []
  headers.extend(("set-cookie", morsel.OutputString())
      for morsel
      in session_cookie.values())
  
  start_response(status, headers)
  </code></pre>
  
  <p>I am also able to read the token and extract the information I need:</p>
  
  <pre><code># Get cookies
  cookies = request.get_cookies()
  #     Get current token from cookies
  token   = cookies['token'].value
  </code></pre>
  
  <p>Now, what would be the best approach to set an expiration to a cookie, I know there is 2 possible keys:</p>
  
  <ol>
  <li>session_cookie['key']['max-age'] = "time in secods"</li>
  <li>session_cookie['key']['expiration'] = "a date in the future"</li>
  </ol>
  
  <p>How could I know if a token is expired or what could be the best way to manage expired tokens ?</p>
  
  <p>Thanks a lot!</p>