Generate API tokens for django-restframework
Project description
django-apitokens
Generate tokens compatible with Django Restframework (drf
) from your Django Admin view:
- Create new tokens at will (after being generated, they no longer can be reversed, since only a digest is stored in the database).
- Add expirity dates (supports time and date)
- Remove tokens when you no longer need them.
My Token view
Add token view
Install
- Install the python package:
pip install django-apitokens
- Add
apitokens
to your Django installed apps:
# In your settings.py
INSTALLED_APPS = [
...
'apitokens',
]
- Ensure you are using
knox
TokenAuthentication
class:
# In your settings.py
REST_FRAMEWORK = {
...,
'DEFAULT_AUTHENTICATION_CLASSES': (
'knox.auth.TokenAuthentication',
...,
),
...,
}
- You are set to use tokens generated through this app as a way to login with the DRF framework.
Contributing
To contribute code to this app, ensure you're following the community guidelines
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-apitokens-0.0.1.tar.gz
(10.2 kB
view details)
Built Distribution
File details
Details for the file django-apitokens-0.0.1.tar.gz
.
File metadata
- Download URL: django-apitokens-0.0.1.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9d7adb0e1c5451dc625588c47913d498ad7a3f9065aea1264850c3456d8f86c |
|
MD5 | b29f5d6f3387cef0c6f14227e1a0d4c5 |
|
BLAKE2b-256 | 9b58402b98536dbff74b3ee08d3d05db94490f7e8d072b322042fa7a5c83ba4d |
Provenance
File details
Details for the file django_apitokens-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: django_apitokens-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 900c1d2ac8b32b544e968fd6e151691426344d3ea6a2553c39956f8392b7f5d1 |
|
MD5 | be12510a1b06381db40267426e7d2bd9 |
|
BLAKE2b-256 | 4b56b5c47d8b036f999fa6544e9d3ad73af9defacec3fa0e61baf3fbbf0d0960 |