21 lines
574 B
Python
21 lines
574 B
Python
def jwt_response_payload_handler(token, user=None, request=None):
|
|
"""
|
|
Returns the response data for both the login and refresh views.
|
|
Override to return a custom response such as including the
|
|
serialized representation of the User.
|
|
|
|
Example:
|
|
|
|
def jwt_response_payload_handler(token, user=None, request=None):
|
|
return {
|
|
'token': token,
|
|
'user': UserSerializer(user, context={'request': request}).data
|
|
}
|
|
|
|
"""
|
|
return {
|
|
'id': user.id,
|
|
'token': token,
|
|
'username': user.username,
|
|
}
|