16 lines
420 B
Python
16 lines
420 B
Python
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
|
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
|
|
|
|
|
class CustomTokenObtainPairSerializer(TokenObtainPairSerializer):
|
|
@classmethod
|
|
def get_token(cls, user):
|
|
token = super().get_token(user)
|
|
|
|
token['user_uuid'] = user.uuid
|
|
|
|
if 'user_id' in token:
|
|
del token['user_id']
|
|
|
|
return token
|