Skip to content Skip to sidebar Skip to footer

Store More Than Default Information In Django-rest-framework-jwt

I am using Django version 1.8 and authentication with django-rest-framework-jwt. After authentication, our application will return to front-end with information: from rest_framewor

Solution 1:

You can override the payload that is attached to the token with the JWT_PAYLOAD_HANDLER setting.

The default implementation includes the username, user_id, email, and exp (expiration time), as you've noticed. You can find the default implementation on GitHub.

Solution 2:

I think what you need is a custom user model. You can create this by creating a new Model with the fields you need and reference it to the Default User model via a One-One relationship.

This link might help - http://blog.mathandpencil.com/replacing-django-custom-user-models-in-an-existing-application/

Post a Comment for "Store More Than Default Information In Django-rest-framework-jwt"