TAGS :Viewed: 5 - Published at: a few seconds ago

[ Pylons, cookies not being destroyed ]

I am trying to remove a cookie called "session" to logout a user.

request.cookies.pop('session', None)
response.set_cookie('session', '', max_age=-100, domain='.example.org')
response.set_cookie('session', '', max_age=-100, domain='www.example.org')
response.delete_cookie('session', '', domain='.example.org')
response.delete_cookie('session', '', domain='www.example.org')

As you can see, I am literally trying everything right now.

Nothing seems to erase the cookie.

Any help is appreciated.

Thank you!

Answer 1

If you're using Pylons' built-in sessions with Beaker, it is much simpler to use session.invalidate() and session.delete().

Are you using Beaker, or are you rolling your own solution for this ?