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

refreshtoken过期的问题 #3

Closed
woann opened this issue May 5, 2022 · 11 comments
Closed

refreshtoken过期的问题 #3

woann opened this issue May 5, 2022 · 11 comments
Labels
question Further information is requested

Comments

@woann
Copy link

woann commented May 5, 2022

按照目前这种情况,假如token有效期两小时,refreshtoken有效期7天。token过期了,可以凭refreshtoken获取新token,但是refreshtoken一直是7天有效期的话,就会出现,当refreshtoken过期了的时候,就需要重新登录了,这种场景下,就可能会出现用户正在正常使用的过程中,突然需要重新登录了

@Tinywan
Copy link
Owner

Tinywan commented May 5, 2022

如果你不想让他过期可以设置为30天,或者更加长的时间。token有效期,refreshtoken有效期你都是可以更加业务自定义

@woann
Copy link
Author

woann commented May 5, 2022

好的谢谢,那么refreshtoken如何刷新呢,或者说如何给refreshtoken增加存活期

@Tinywan
Copy link
Owner

Tinywan commented May 5, 2022

refreshtoken 不可以刷新,目前只有配置文件可以修改过期时间。不支持增加存活期

@woann
Copy link
Author

woann commented May 5, 2022

好吧。。建议你处理一下这个问题,正常应该是用户无感知的。目前的状况,即便我把refreshtoken的有效期加的再长,到期后也可能会出现用户正在使用的时候,突然需要重新登录了

@woann woann closed this as completed May 5, 2022
@Tinywan
Copy link
Owner

Tinywan commented May 5, 2022

用户无感知,就是使用refreshtoken换取accesstoken就可以了,不建议refreshtoken设置的比较长。会存在安全隐患。你的需求可否详细说明一下?

@woann
Copy link
Author

woann commented May 5, 2022

举个例子。accesstoken有效期2小时,refreshtoken8小时,每2小时用refreshtoken获取一次新的accesstoken,当第10个小时accesstoken又过期了的时候,再用refreshtoken获取accesstoken就不行了,因为这时候refreshtoken也过期了。此时两个token都过期了,就只能重新登录了。

@Tinywan
Copy link
Owner

Tinywan commented May 5, 2022

我们实际业务中

  • accesstoken有效期2小时
  • refreshtoken有效期7天

以上并没有遇到什么问题

@woann
Copy link
Author

woann commented May 5, 2022

7天之后refreshtoken不过期吗。。

@Tinywan
Copy link
Owner

Tinywan commented May 5, 2022

过期,需要重新登录。其实就像微信的那个令牌一样,设置有效期也是为了安全

@woann
Copy link
Author

woann commented May 5, 2022

需要登录倒是对的,但是一般都是用户很长时间没有用过app的情况下才重新登录,如果用户一直都正常使用或者说每天都在使用的情况下,不应该用着用着突然跳登录去了

@Tinywan
Copy link
Owner

Tinywan commented May 5, 2022

那你设置过期时间长点不就可以解决了吗?哈哈!

@Tinywan Tinywan added the question Further information is requested label May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants