How can I set in Tornado a secure cookie that expires when the browser is closed?
If I use set_cookie
I can do this without passing extra arguments (I just set the cookie), but how if I have to use set_secure_cookie
?
I tried almost everything:
Session cookies expire once you log off or close the browser. They are only stored temporarily and are destroyed after leaving the page. They are also known as transient cookies, non-persistent cookies, or temporary cookies.
If the website doesn't set the expiry date, the browser will delete the cookie once it's closed. The average lifetime of a cookie is about 30 days, but cookies can also be set to last for over a year.
The cookie has an Expire attribute that defines a specific date and time, after which the browser should stop sending the cookie and delete it.
It seems to me that you are really on the right track. You try lower and lower values, and the cookie has a lower and lower expiration time.
Pass expires_days=None
to make it a session cookie (which expires when the browser is closed).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With