1👍
The best thing I can suggest to you is not to implement the JWT logic by yourself. Please use the package dj_rest_auth
or if you only need the JWT logic, use SimpleJWT
. The dj_rest_auth package provides you with full-featured functionalities for authentication and authorization. It also uses SimpleJWT by default as its backend for JWT implementation and functionalities.
Links:
https://dj-rest-auth.readthedocs.io/en/latest/
https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
Source:stackexchange.com