How to delete a django JWT token?

后端 未结 2 491
别跟我提以往
别跟我提以往 2020-12-18 06:29

I am using the Django rest framework JSON Web token API that is found here on github (https://github.com/GetBlimp/django-rest-framework-jwt/tree/master/).

I can succ

相关标签:
2条回答
  • 2020-12-18 06:51

    Yes, it's correct to say that JWT tokens are not stored in the database. What you want, though, is to invalidate a token based on user activity, which doesn't seem to be possible ATM.

    So, you can do what you suggested in your question, or redirect the user to some token refreshing endpoint, or even manually create a new token.

    0 讨论(0)
  • 2020-12-18 07:01

    The biggest disadvantage of JWT is that because the server does not save the session state, it is not possible to abolish a token or change the token's permissions during use. That is, once the JWT is signed, it will remain in effect until it expires, unless the server deploys additional logic. So, you cannot invalidate the token even you create a new token or refresh it. Simply way to logout is remove the token from the client.

    0 讨论(0)
提交回复
热议问题