Skip to main content

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


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

Uploaded Source

Built Distribution

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

drf_api_auth-0.1.4-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file drf_api_auth-0.1.4.tar.gz.

File metadata

  • Download URL: drf_api_auth-0.1.4.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for drf_api_auth-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b53a6055548096a4599880f9aaddc55cfaeb1040c47add1e3049a399862d9bfb
MD5 1ddaa7495748ab93e3343d23d4a98648
BLAKE2b-256 27db6da473a3776b6c43a9d598699db8ea892b71fce228cf4a340bdd8a2779a7

See more details on using hashes here.

File details

Details for the file drf_api_auth-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: drf_api_auth-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for drf_api_auth-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c3f2bdae2d3e24db61297d7a4b6c2072feef0bf62458a8528ae73dd263511a73
MD5 09d07b5a7c87dde2b8c679d11205bac7
BLAKE2b-256 bf26a7055f8dbf33ee34a3c3c5f0029ee1f10ba02ea93faa022d56f7fae229cf

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