gateway_placeholder/gateway/security/serializers.py

14 lines
405 B
Python

from rest_framework_simplejwt.serializers import TokenRefreshSerializer
from rest_framework_simplejwt.tokens import RefreshToken
class CustomTokenRefreshSerializer(TokenRefreshSerializer):
def validate(self, attrs):
refresh = RefreshToken(attrs['refresh'])
data = {
'refresh': str(refresh),
'access': str(refresh.access_token),
}
return data