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",
},
)
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django_rest_framework_apikeys-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d2c392f27403db0a647f7cf4464ae355991333c9719052ed5c4affd8fbdd060 |
|
MD5 | 6687810fb9768fb3e3087fa15c51aaca |
|
BLAKE2b-256 | d26d744ecb39401e32a69c7e2d3cc1bb55585dd03f8d1df3ff2606cf76cf5089 |