micro_service_placeholder/microService/security/serializers.py

14 lines
405 B
Python
Raw Normal View History

2024-11-30 05:34:13 +00:00
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