Revoke current token
See original GitHub issueI am implementing an API in flask using your lovely library for a jwt-based authentication. I would like to offer the authenticated client the option to revoke its own token (“logout”). How would I implement this? I am using redis for the blacklist backend. As far as I can tell, the only way to revoke a token is by its jti. However, the library only stores the identity and the user claims on the app context.
Would it make sense to store the full jwt on the app context and have the get_jwt_identity and get_jwt_claims functions just return the appropriate fields? This would allow for another function that returns the jti.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Revoke Tokens - Auth0
Describes how to use tokens to control user access. ... Once issued, access tokens and ID tokens cannot be revoked in the same...
Read more >Revoking tokens - Amazon Cognito - AWS Documentation
You can revoke a refresh token for a user using the AWS API. When you revoke a refresh token, all access tokens that...
Read more >Revoke Tokens - Okta Developer
This guide explains how to revoke access or refresh tokens with Okta. Learning outcomes. Revoke tokens. Remove user sessions. About the revoke request....
Read more >token revoke - Command | Vault - HashiCorp Developer
The "token revoke" revokes authentication tokens and their children. If a TOKEN is not provided, the locally authenticated token is used.
Read more >OAuth 2.0 Token Revocation
The Token Revocation extension defines a mechanism for clients to indicate to the authorization server that an access token is no longer needed....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

That seems perfectly reasonable to me. We can add a new
get_raw_jwtor something along those lines. We could take it a step farther and also add aget_jwt_jtimethod as well, if that would make things simpler.I’ll see about getting a new released pushed which addresses this later today.
Thanks for the feedback! 👍
Thanks 😃
That is released as version 1.1.0. It should be available on pypi shortly. I’m going to go ahead and close this issue, but if any problems come up, please go ahead and re-open it.
Cheers!