Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting a Secure Cookie in tornado

I just started learning about webservers, tornado in particular.

I want to write a simple webpage with a login function. As described in the Tornado Documentation, I'm creating a secure cookie after the user was successfully loged-in:

self.set_secure_cookie("user", self.get_argument("user"))

But how do I provide the user with a way to log-out? As mentioned before, I'm not familiar with web servers, but as I'm checking this cookie when the user attempts to enter the Main-Page, I guess I'd just have to remove it after the user pressed "logout"?

Unfortunately, I could'nt find anything about this in the tornado documentatoin, nor on SO.

like image 375
buddybubble Avatar asked Jan 03 '12 15:01

buddybubble


1 Answers

You could reset the cookie to an empty string via

self.clear_cookie("user")

Which would make the call to get_current_user return False. Take a look at the blog demo for an example (using OAuth, but still relevant).

like image 141
jeffknupp Avatar answered Sep 17 '22 12:09

jeffknupp