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

Fast way to check if JWT is expired. #428

Closed
calebmer opened this issue Dec 17, 2015 · 3 comments
Closed

Fast way to check if JWT is expired. #428

calebmer opened this issue Dec 17, 2015 · 3 comments
Labels

Comments

@calebmer
Copy link
Contributor

Can we think of a super fast way to check if a JWT has expired? In my application code which uses the refresh token model I can either: 1) Refresh my token every request (slow). 2) Try a request, catch failures, refresh the token, and try again. 3) Request some route to see if the token has expired (server still does some calculations). None of these are optimal, so is there any way we could develop a fast method for checking JWT expiration?

Maybe we use the recommended ping request of OPTIONS *. It always succeeds with no authentication, and fails fails with bad authentication. Of course doing authentication parsing could slow down other ping requests.

Side note, I haven't checked to see if a GET / request will fail with an expired token, but even if it does the server still does some calculations which aren't required.

@calebmer
Copy link
Contributor Author

A solution to this could also be helpful if @diogob wanted to write an extended refresh token implementation into his auth example.

@begriffs
Copy link
Member

begriffs commented Apr 3, 2016

Naively I would assume that option two is the standard way. When requests fail due to token expiration you ask for a new token and try again.

@ruslantalpa
Copy link
Contributor

Jwt is just base64, anyone can decode it and look at its contens. (This can be closed)

@begriffs begriffs closed this as completed Sep 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants