Additions for Django Rest Framework Simple JWT
Project description
DRF SimpleJWT additions
Additional features for django-rest-framework-simplejwt.
Features
- Full user info in TokenObtainPairSerializer
- Full user info in TokenObtainPairView
Installation
pip install drf-simplejwt-additions
Usage
Full user info in TokenObtainPairSerializer
In settings.py
:
INSTALLED_APPS = [
...
'drf_simplejwt_additions',
...
]
...
SIMPLE_JWT = {
...
"TOKEN_OBTAIN_SERIALIZER": "drf_simplejwt_additions.serializers.TokenObtainPairWithFullUserSerializer",
...
}
From now on, the response of the TokenObtainPairView
will contain the full user info.
Serializer get all fields from the user model, except password
and fields that start with _
.
Then theses fields are added to the response in the user
field.
Full user info in TokenObtainPairView
In urls.py
:
from drf_simplejwt_additions.views import TokenObtainPairWithFullUserView
urlpatterns = [
...
path('api/token/', TokenObtainPairWithFullUserView.as_view(), name='token_obtain_pair'),
...
]
The TokenObtainPairWithFullUserView
is a subclass of TokenObtainPairView
with the TokenObtainPairWithFullUserSerializer
serializer.
License
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
Built Distribution
Close
Hashes for drf-simplejwt-additions-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 746e4d4b8a89a046a8f5b7c6851e966f96cc4540334aa1acebdff9caef96605c |
|
MD5 | af2b15c15dbba5c38c65a83bba0a0b86 |
|
BLAKE2b-256 | a6fb8686046ff66756d0fd0a0e74070a43d6fb50120c8368f096cece89d2c908 |
Close
Hashes for drf_simplejwt_additions-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ffd06716d0ccad3945ae8010c31c485db387f3bd588308b17a5f276e769cc0d |
|
MD5 | 765605a74a3f941b3a24d73f35fa127a |
|
BLAKE2b-256 | 0c14b34da52a4b67ccf2368e4b9d525dbbbfe4fd96a5039d99328c9c4c7b67bb |