A Django app to authenticate by api_key and api_secret
Project description
Django REST Framework API Auth
Django REST Framework API Auth is a secure API Key and Secret authentication plugin for REST API built with Django Rest Framework.
Quickstart
1 - Install with pip
:
pip install drf-api-ath
2 - Register the app in the INSTALLED_APPS
in the settings.py
file:
# settings.py
INSTALLED_APPS = [
# ...
"rest_framework",
"drf_api_auth",
]
4 - Run migrations:
python manage.py migrate
In your view then, you can add the authentication class.
⚠️ Important Note: By default, authentication is performed using the
AUTH_USER_MODEL
specified in the settings.py file.
from rest_framework import viewsets
from drf_api_auth.authentications import ApikeyAuthentication
from rest_framework.response import Response
class TestViewSets(viewsets.ViewSet):
authentication_classes = (ApikeyAuthentication,)
def list(self, request):
return Response([{"message": "Ok"}], 200)
TODO
- Prevent save api_key as clear text
- Toggling (show/hide) for api_key admin field
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
drf_api_auth-0.1.3.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file drf_api_auth-0.1.3.tar.gz
.
File metadata
- Download URL: drf_api_auth-0.1.3.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c23c657a6aa8ff90a3f2ad9eeee465acb002fb759d3bd9a729f5820863819f0 |
|
MD5 | dfb31c6ada0f7205e49bda2a686a6439 |
|
BLAKE2b-256 | 20be03211fdde2ef40be6eba61f77229273d94071930d25aa3d1d9a61c2a0094 |
File details
Details for the file drf_api_auth-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: drf_api_auth-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d518e304d05f5540de1797c767bc29810617508759c616772d3cdbd888c6a4f |
|
MD5 | d2c76434ea035966ee2eb91797c0e969 |
|
BLAKE2b-256 | 235168409b3e6a4dfacf26a0654791cfa089d6d4b19b8030b06d5d50f37150b7 |