Skip to main content

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

Screenshot 2023-03-21 at 14 47 02

Add token view

Screenshot 2023-03-21 at 14 47 19

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


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.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_apitokens-0.0.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file django_apitokens-0.0.3.tar.gz.

File metadata

  • Download URL: django_apitokens-0.0.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for django_apitokens-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c172157ad7fe20d3449160e502a271721417005ef8a396d094d67f091ffa2431
MD5 85dafbda09be38d08ecaf946a5ea7fcd
BLAKE2b-256 8604e7fef5953a6918741257ed9df43b1970d7ab3825f526ca7e2daf1761ed9e

See more details on using hashes here.

File details

Details for the file django_apitokens-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_apitokens-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 677d43f0c65f284d6696c5de215cd86ddc4ff28e1ac7a1c2b0adf77dda5c8e20
MD5 947178cda165e0816978a0a8cc4225c9
BLAKE2b-256 8322beaf67cc451b60ebbb700e266ed8c3c87598a18f74570db9daacc678ffcf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page