DRF Body Token
Provide a Django REST Framework authentication class, to look for token in HTTP request’s body, instead of HTTP header.
This use case is uncommon and may be less secure, but some REST client application doesn’t let customize HTTP header, and hence, user cannot set Authorization header. One such client is Blynk Webhook Widget.
Install
pip3 install drf-body-token
DRF Body Token only supports Python 3.5+.
Usage
Add BodyTokenAuthentication to authentication_classes atrribute of your viewset. Example:
from drf_body_token.authentication import BodyTokenAuthentication
class MyAwesomeViewSet(GenericViewSet):
authentication_classes = (TokenAuthentication, BodyTokenAuthentication)
You can also add it to REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] settings, to make it available for every viewset.
By default, BodyTokenAuthentication looks for access_token field in request’s body. That body can be, for example:
{
"name": "Cuckoo",
"type": "bird",
"access_token": "Vừng ơi mở ra"
}
If you want it to look for another field, add this to your settings.py file:
DRF_BODY_TOKEN_FIELD = 'your_field'
Metadata
Release files for drf-body-token 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| drf-body-token-0.1.0.tar.gz | 2.8 kB | Without provenance | Details for drf-body-token-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| drf_body_token-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for drf_body_token-0.1.0-py3-none-any.whl |
Total release size: 6.9 kB
Release files / drf-body-token-0.1.0.tar.gz
| Download URL | drf-body-token-0.1.0.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14b8ac6d1b43387d8e836aacee8382934218a86ed2b27faf3a8fd5973a9f4809
|
|
BLAKE2b-256 checksum How to use checksums |
83a53ef696e556870ad31710ded7260e1b97326867a126f9fd1c118fc92c81be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.10 CPython/3.6.7 Linux/4.18.0-13-generic
|
Release files / drf_body_token-0.1.0-py3-none-any.whl
| Download URL | drf_body_token-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
995b84c3b58e81cc152df58d11f51a9d4da8615c3108ebec2533fce9d712ad4c
|
|
BLAKE2b-256 checksum How to use checksums |
e3c588e1b9c8a7ab0cb500f95668d58153654a06d200c53526d35e451d76c3ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.10 CPython/3.6.7 Linux/4.18.0-13-generic
|
Security for drf-body-token 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.