Hey all!!
I have made a custom token create serializer in djoser for user login.
When i am using in-built token create it is giving me the correct output of refresh and access token, But when i use custom one it is giving me the ‘auth_token’ as an output.
#Serializers
class CustomTokenCreateSerializer(TokenCreateSerializer):
def validate(self, attrs):
data = super().validate(attrs)
# Update last_login
self.user.last_login = now()
self.user.save(update_fields=['last_login'])
# Generate token
refresh = RefreshToken.for_user(self.user)
data['refresh'] = str(refresh)
data['access'] = str(refresh.access_token)
print(data['refresh'])
print(data['access'])
return data
I have also addes a path in urls.py.