Closed vparenti closed 6 years ago
+1
You just make a custom payload handler, e.g.:
from rest_framework_jwt.utils import jwt_payload_handler
def jwt_custom_payload_handler(user):
payload = jwt_payload_handler(user)
payload['role'] = 'xyz'
return payload
Then in your settings you just need:
JWT_AUTH['JWT_PAYLOAD_HANDLER'] = 'path.to.your.jwt_custom_payload_handler'
Could we add this to the docs then? @vparenti / @mauzepeda a PR would be welcome.
Closing in favor of https://github.com/GetBlimp/django-rest-framework-jwt/pull/389 already. Thanks, @mauzepeda!
I would like add more information in payload json, for example 'role' and 'company'. Is there a way? Thanks, V