Skip to content

登录 token 的过期问题 #21

Closed

Description

@dchaofei

看您的源码时发现登录接口存了 token 的过期时间, apiPrivCheck却没有检查 token 的过期时间,很疑惑

Activity

  1. added
    bug
    on Jan 16, 2019
  2. dreamans commented on Jan 16, 2019

    @dreamans
    Owner

    目前来看确实是个问题,如果不主动退出或重新登录的话,token将永远有效,感谢反馈,会尽快修复的 😄

  3. dreamans commented on Jan 16, 2019

    @dreamans
    Owner

    可以顺便提个 PR

  4. dchaofei commented on Jan 16, 2019

    @dchaofei
    ContributorAuthor

    不知道用什么机制比较好,如果用户正在操作过程中,突然 token 过期了,跳到重新登陆了,那就比较尴尬了。
    不知道这样行不行,如果检查到 token 过期直接延长一下过期时间

  5. dchaofei commented on Jan 16, 2019

    @dchaofei
    ContributorAuthor

    不知道用什么机制比较好,如果用户正在操作过程中,突然 token 过期了,跳到重新登陆了,那就比较尴尬了。
    不知道这样行不行,如果检查到 token 过期直接延长一下过期时间

    这样不好,相当于还是不会过期

  6. lgphone commented on Jan 16, 2019

    @lgphone

    不知道用什么机制比较好,如果用户正在操作过程中,突然 token 过期了,跳到重新登陆了,那就比较尴尬了。
    不知道这样行不行,如果检查到 token 过期直接延长一下过期时间

    这样不好,相当于还是不会过期

    每次请求api的时候延长下token时间即可,如果长时间不请求说明token已经过去,需要重新登陆,符合大部分网站的逻辑(比如阿里云控制台)

  7. dreamans commented on Jan 16, 2019

    @dreamans
    Owner

    不知道用什么机制比较好,如果用户正在操作过程中,突然 token 过期了,跳到重新登陆了,那就比较尴尬了。
    不知道这样行不行,如果检查到 token 过期直接延长一下过期时间

    这样不好,相当于还是不会过期

    每次请求api的时候延长下token时间即可,如果长时间不请求说明token已经过去,需要重新登陆,符合大部分网站的逻辑(比如阿里云控制台)

    💯

  8. dreamans commented on Jan 16, 2019

    @dreamans
    Owner

    不知道用什么机制比较好,如果用户正在操作过程中,突然 token 过期了,跳到重新登陆了,那就比较尴尬了。
    不知道这样行不行,如果检查到 token 过期直接延长一下过期时间

    可在service/user/token.go中定义一个更新token失效时间方法;
    在apiPrivCheck方法的最后调用,调用时起一个新的 goroutine 来执行,并且可以忽略更新失败这个error;

  9. dchaofei commented on Jan 16, 2019

    @dchaofei
    ContributorAuthor

    好的,我一会提 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions