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

Token Expire Time Management #1

Open
yxdy1990 opened this issue Feb 23, 2019 · 3 comments
Open

Token Expire Time Management #1

yxdy1990 opened this issue Feb 23, 2019 · 3 comments

Comments

@yxdy1990
Copy link

Do you have any idea for the managment of token expire?

@bootsrc
Copy link
Owner

bootsrc commented Feb 23, 2019

Do you have any idea for the managment of token expire?
Reply
This is a good question! I want to add expireTome (expireDelta = Delta) to the project, but I don't have time to do it yet.
This is my solution.

Persist expireDelta = Delta (expire interval value) to the database. And write it in redis at the same time.
When the user invokes the web API, if the permission authentication passes, set updated 'endTime' to redis( Now endTime = oldEndTime + Delta )

If the user is calling the web API frequently and at intervals < Delta., it can access the API normally all the time without being blocked to the login window. If curentTime < endTime, let the request go ahead.

Just like QQ login. If you log in every day, you can log in automatically. If you don't log in for 2 months, you need to re-enter your password to log in.

Thank you for your support!

@yxdy1990
Copy link
Author

Quick response ! Got it.
But I think that It's better to have one API to do the "refresh" action. Instead of updating endTime in every API request. This is my humble opinion.

Thanks !

@bootsrc
Copy link
Owner

bootsrc commented Feb 23, 2019

Yes, this is one option

@bootsrc bootsrc pinned this issue Mar 2, 2019
@bootsrc bootsrc closed this as completed Mar 2, 2019
@bootsrc bootsrc reopened this Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants