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