Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7021763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:29:35+00:00 2026-05-27T23:29:35+00:00

By default, cookies expires at session end, so user need to login every time

  • 0

By default, cookies expires at session end, so user need to login every time after closing the browser. But what about remember option – how to set cookie with no expiration date? I’ve tried to add session.cookie_expires = False in development.ini file, but it didn’t help.

And another question: how to set custom cookie header (for example lang to main cookie with no expiration date too)?

EDIT:

I’ve found max_age parametr in pyramid.authentication.AuthTktAuthenticationPolicy which lets you save a cookie between sessions. But how to implement remember me checkbox when max_age defines it in __init__.py (config) file and remember me must be defined in login view?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:29:36+00:00Added an answer on May 27, 2026 at 11:29 pm

    The idea behind “remember me” is that it’s an option that lasts between logins and sessions. This is best implemented as a separate cookie that you can set if the user checks the box. If “remember me” means that the application should log you back in if the policy has expired, then simply store a signed cookie that never expires. Then when the application raises an HTTPForbidden because the user isn’t logged in, you can check for the cookie, see that they wanted to be remembered, log them back in, and redirect them back to where they were trying to go. That’s just one option, depending on what you mean by “remember me”.

    Configuring Pyramid’s Default Session Factory

    If you are using the UnencryptedCookieSessionFactoryConfig session factory, then you need to pass an appropriate value for the cookie_max_age argument. The timeout parameter is also checked, which is a signed timestamp stored within the cookie. Combined with max_age, the actual expiration time of the session would be the minimum of max_age and timeout.

    http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/api/session.html#pyramid.session.UnencryptedCookieSessionFactoryConfig

    Creating Custom Cookies

    To set a custom cookie you simply need to call response.set_cookie() with the parameters you’d like. If you are using a renderer then you can access the response object that’s used via request.response. Otherwise if you are manually creating a response object yourself, just set it there.

    http://docs.pylonsproject.org/projects/pyramid/en/1.3-branch/api/response.html#pyramid.response.Response.set_cookie

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using the default cookies as my single sign on (SSO) but some
By default, Glassfish v3 doesn't set the httpOnly flag on session cookies (when created
I have a problem with session expiry. Firstly it expires every 20 minutes and
I have used sessions before but never cookies. I would like to use cookies
By default tomcat will create a session cookie for the current domain. If you
By default the session expiry seems to be 20 minutes. Update: I do not
There's no access to the HTTP cookies from within a Flash movie, but I
Are iPhone cookies enabled by default when you buy an iPhone? I ask as
I'm using sessions in Django to store login user information as well as some
I have 2 login controls on a web application one on default and one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.