Django Expiring Token
Django Expiring Token adds token expiration on token authentication and extends the expiration time on each authenticated request.
Django Expiring Token provides a very lightweight extension to DRF’s existing token authentication. It implements the following functionalities:
Tokens expire after the set time.
On each authenticated request, the expiration time is updated by the set time.
Quick start
Do NOT add “restframework.authtoken” to you INSTALLED_APPS.
Add “drf_expiring_token” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'drf_expiring_token', ]Include the polls URLconf in your project urls.py like this:
path('custom-url/', include('drf_expiring_token.urls')),Add the expiration time in settings.py:
EXPIRING_TOKEN_DURATION=timedelta(hours=1) # Any timedelta setting can be used! If not set, the default value is 1 day
Add the default authentication class in REST_FRAMEWORK settings in settings.py:
REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( ... 'drf_expiring_token.authentication.ExpiringTokenAuthentication', ... ), }Run python manage.py migrate to create package migrations
Start the development server an you are good to go.
Tests
This build is tested against Python versions 3.4, 3.5, 3,6 with Django versions 2.0.8+
To run tests
Install coverage:
pip install coverage
Run tests:
coverage run runtest.py
Metadata
Release files for drf-expiring-token 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| drf-expiring-token-1.1.2.tar.gz | 7.0 kB | Without provenance | Details for drf-expiring-token-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| drf_expiring_token-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for drf_expiring_token-1.1.2-py3-none-any.whl |
Total release size: 15.1 kB
Release files / drf-expiring-token-1.1.2.tar.gz
| Download URL | drf-expiring-token-1.1.2.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f03d254694f206d70858e3feea144c871d5dd0e1d7c61c2311b0f678c8e73406
|
|
BLAKE2b-256 checksum How to use checksums |
8b2a824c9b33fb9717d086e76b65309a03c03815385aecb64ba70fcc1a1cb362
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|
Release files / drf_expiring_token-1.1.2-py3-none-any.whl
| Download URL | drf_expiring_token-1.1.2-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0623a1d1aef5b275fcc7d1d250228ec4591bbcf6b015c3afde2344a2efc00d4
|
|
BLAKE2b-256 checksum How to use checksums |
d53021e2ae01a1ceeeefcd975c50f7813709385682156b04b9910b15ff0a830b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
|
Security for drf-expiring-token 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.