Issue
I am using Django Rest Framework and i've included a 3rd party package called REST framework JWT Auth. It returns a token when you send a username/password to a certain route. Then the token is needed for permission to certain routes. However, how do I get the username from the token? I've looked all through the package documentation and went through StackOverflow. It is a JSON Web Token and I am assuming there is a method like username = decode_token(token)
but I haven't found such a method.
Solution
Basically you could do this
username = request.user.username
Answered By - Sardorbek Imomaliev
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.