Skip to main content

Django app for remember-me functionality (using a token)

Project description

Add the auth_remember authentication backend to django:


Add the remember middleware in your settings, right after AuthenticationMiddleware:


Add auth_remember to INSTALLED_APPS:


Set the cookie name and expire time (optional):

AUTH_REMEMBER_COOKIE_NAME = 'remember_token'
AUTH_REMEMBER_COOKIE_AGE = 86400 * 28  # 4 weeks by default

Set the expire time of the session to browser close (optional):


To remember a user add the following code to your authentication handler:

from auth_remember import remember_user
remember_user(request, user)

Use the user.is_fresh attribute to test if the user is fresh:

{% if user.is_fresh %}
    This user session is fresh
{% else %}
    This user session is NOT fresh
{% endif %}

Under the hood auth_remember uses the session var AUTH_REMEMBER_FRESH to indicate if the user session is fresh. The name of the session var can be changed by setting the AUTH_REMEMBER_SESSION_KEY in you’re settings file.


  • Introduce settings for AUTH_REMEMBER_COOKIE_DOMAIN

Project details

Release history Release notifications

This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-auth-remember-0.3.tar.gz (7.7 kB) Copy SHA256 hash SHA256 Source None Feb 28, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page