-
Notifications
You must be signed in to change notification settings - Fork 176
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
How to deal with token expiration? #5
Comments
Thanks Frank, I agree. I just haven't gotten around to implementing it yet. |
First of all, please note that token expiration and revoking are two different things.
1. How to make a JWT token expireA JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data. Quoted from JWT RFC:
So the answer is obvious, set the expiration date in the Quite easy, huh? The problem is that mobile apps never expire, for example, people can reopen the APP after a month without the need to login again.
2. How to revoke a JWT tokenSometimes users need to revoke a token, for example, clicking the logout button, or changing the password. Assume that each user has multiple devices, let's say, a browser, a native iPhone APP, and a native Android APP. There are three ways:
Suggestions are welcomed, please correct me if I'm wrong. 3. How to use JWT tokens SecurelyFirst, always use HTTPS to make sure JWT tokens transmission over network is safe. By using HTTPS nobody can sniff users' JWT tokens over network. Second, make sure JWT tokens are stored securely on users' Android, iOS and browser.
As long as we make the browsers, user devices and tokens transmission safe, token revocation mechanism is not necessary anymore.We can still keep our RESTful services stateless. Reference |
first of all thanks for brahalla for this git repository. very easily understandable code. |
I don't know a ton about native mobile app development. A quick google search lead me to this Stack Overflow question. Seems like for iOS you would store it in the keychain, which seems reasonable to me. For Android, looks like the KeyStore. If you're doing a hybrid app your guess is as good as mine... for anything using Cordova I would probably just put it in localstorage. |
@soulmachine Your discussion helps me a lot,thanks. |
Is it already impplemented? and still after 1 week my token is expired
@throws ExpiredJwtException if the specified JWT is a Claims JWT and the Claims has an expiration time |
I think token expiration is a key feature that this project is lack of, here are some good discussions on Hacker News, https://news.ycombinator.com/item?id=8283006
The text was updated successfully, but these errors were encountered: