gin-jwt icon indicating copy to clipboard operation
gin-jwt copied to clipboard

Can I set The timeout time so tokens never expire?

Open ShayanJa opened this issue 8 years ago • 5 comments
trafficstars

I want the user to be logged out after a week of not using the site. How can I do this?

ShayanJa avatar Jul 25 '17 22:07 ShayanJa

Refresh the token at the end of the week.

zhaowangdaren avatar Aug 03 '17 00:08 zhaowangdaren

even you refresh the token, the old token is also can be use. so maybe you can create a blacklist to stop using the old token

gonboy avatar Dec 13 '17 00:12 gonboy

You can pass something like this to Timeout:

Timeout: time.Duration(24*365) * time.Hour, // one year

I'm not sure if it's good solution, but it works :)

DevAlone avatar Mar 26 '18 14:03 DevAlone

@DevAlone yes but this will set the timeout for one year only, what happens after one year...

@appleboy : thanks for this amazing work. For setting token that never expires, do you provide something like "Timeout: 0,"?

viseth avatar Oct 23 '19 10:10 viseth

@viseth why don't you try to set expiration to 100 years?

bery avatar Nov 09 '21 14:11 bery