-
Notifications
You must be signed in to change notification settings - Fork 126
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
Extend token expiration #233
Comments
you'll have to generate a new token and pass it to the user. Another way will be using a key/value store such as Redis and store the token without expiration date, It will also help you to restrict access without changing the secret key if needed to. |
Thank you @doron2402 , can I generate a new token and pass it back to the client from the validate function (since this is the place where I find out if a token expired)? Regarding the Redis solution, what do you mean by it will help me restrict access without changing the secret key? |
np @roytz, for your first question, you can return the new token inside the header and make sure to use it on the client. if you have some sort of a middle layer between your api you can force the For your second question regarding Redis, JWT token have a life time lets say a week. and lets say that some how your token got leaked or someone hack your user computer and now holds the JWT token. there's no way for you to restrict this token even if you delete the user from your database and change the user password. |
thanks @doron2402 |
In the validate function, I don't have a way to return a new token. (there is no reply method) |
you can overwrite the validate function to return a callback/promise with the token. |
validateFunc is very limited
|
@bitcloud yes |
great! what about you @roytz? otherwise you can close this issue. :-) |
Thanks @bitcloud |
Hi,
I've set the token
exp
value to be7d
.Now, I want to extend the expiration every time the token is being validated and expires in less than 7 days - I want to do that on the
validateFunc
.Here is my
validateFunc
with the TODO part where I want to change the exp value or return a new token with new exp value -How can I do that?
The text was updated successfully, but these errors were encountered: