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.2.tar.gz (10.5 kB view hashes)

Uploaded Source

Built Distribution

django_apitokens-0.0.2-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

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