Skip to main content

django-rest-framework-apikeys allows you to Authenticate your REST api with api keys on a per user basis.

Project description

=====
django-rest-framework-apikeys
=====

django-rest-framework-apikeys allows you to Authenticate your REST api with api keys on a per user basis.

Install
-----------
1. Install via pip::

pip install django-rest-framework-apikeys

Quick start
-----------

1. Add "django-rest-framework-apikeys" to your INSTALLED_APPS settings like this::

INSTALLED_APPS = [
...
'django_rest_framework_apikeys',
]

2. Add the authentication class::

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
...
'django_rest_framework_apikeys.authentication.APIKeyAuthentication',
)
}

3. Run `python manage.py migrate`.

4. Add urls to urlconf::

urlpatterns = [
...
url(r'^apikeys/', include("django_rest_framework_apikeys.urls")),
]


5. Send a POST request to /apikeys/create/ to create API Key for user or create via admin

6. Add 'x-api-key' to header to Authenticate via api key::

response = requests.get(
url="http://0.0.0.0:8000/endpoint,
headers={
"x-api-key": "fd8b4a98c8f53035aeab410258430e2d86079c93",
},
)

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_rest_framework_apikeys-0.1.tar.gz (4.4 kB view hashes)

Uploaded Source

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