Skip to content

th13f/drf-secure-token

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DRF Secure Token

Quick start

  1. Add "drf_secure_token" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'rest_framework',
        'drf_secure_token',
    ]
  2. Add following lines to your settings.py:

    REST_FRAMEWORK = {
        'DEFAULT_AUTHENTICATION_CLASSES': [
            'rest_framework.authentication.BasicAuthentication',
            'drf_secure_token.authentication.SecureTokenAuthentication',
         ]
    }
  3. For updating token add this middleware to your MIDDLEWARE_CLASSES:

    MIDDLEWARE_CLASSES = (
        ...
        'drf_secure_token.middleware.UpdateTokenMiddleware',
    )
  4. Add UPDATE_TOKEN to your 'dev' settings if you don't want to update token in DEBUG mode:

    UPDATE_TOKEN = False
  5. Add TOKEN_AGE to your settings:

    TOKEN_AGE = 60*10 # 10 min
  6. Run python manage.py migrate to create the drf_secure_token models.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%