Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revoke current token #22

Closed
portrain opened this issue Jan 11, 2017 · 6 comments
Closed

Revoke current token #22

portrain opened this issue Jan 11, 2017 · 6 comments

Comments

@portrain
Copy link

I 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.

@vimalloc
Copy link
Owner

That seems perfectly reasonable to me. We can add a new get_raw_jwt or something along those lines. We could take it a step farther and also add a get_jwt_jti method 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! 👍

vimalloc added a commit that referenced this issue Jan 11, 2017
This allows you to use 'get_raw_jwt()' in any jwt protected endpoint
(jwt_required, fresh_jwt_required, refresh_jwt_required).

Refs #22
@portrain
Copy link
Author

I like the idea of the get_raw_jwt method and don't think we need a specialized get_jwt_jti method.

@portrain
Copy link
Author

Oh, just saw that you added a commit pretty much exactly at the time when I sent my response. Thanks a lot!

@vimalloc
Copy link
Owner

That bodes well, cause that what I just added 👍

I'll get a new release pushed to pypi here asap. Lmk if you have any issues with it.

vimalloc added a commit that referenced this issue Jan 12, 2017
@portrain
Copy link
Author

Will do!

@vimalloc
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants