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.1.tar.gz
(5.2 kB
view hashes)
Built Distribution
Close
Hashes for drf_api_auth-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5509bc2356251d02df2c4da45930f06612bfeb014129b077e5e3e876ff494617 |
|
MD5 | e0bfe68b614fe0b7dbb4515755255ae2 |
|
BLAKE2b-256 | f5382df394ad398ea0d56ecc2454dc6ed783f1a0d0a60f0f908a06851c386643 |