alist icon indicating copy to clipboard operation
alist copied to clipboard

登录接口返回token有效期

Open Dreamlings opened this issue 11 months ago • 5 comments

Please make sure of the following things

  • [x] I have read the documentation.
  • [x] I'm sure there are no duplicate issues or discussions.
  • [x] I'm sure this feature is not implemented.
  • [x] I'm sure it's a reasonable and popular requirement.

Description of the feature / 需求描述

在api/auth/login/hash接口中返回token有效期 封装了个接口登录获取token后设置cookie保存token但是不知道有效期多久,导致过期了接口返回{"code":401,"message":"token is invalidated","data":null} 用cookie保存token是为了减少该接口的请求次数

Suggested solution / 实现思路

在返回数据中加一个token有效期的字段 秒为单位

Additional context / 附件

接口: api/auth/login/hash Screenshot_2025-01-27-22-57-31-071_com.reqable.android.jpg

Dreamlings avatar Jan 27 '25 15:01 Dreamlings

用令牌

lxnan888 avatar Jan 28 '25 08:01 lxnan888

我目前发现的一个问题,临时token签发后,在服务重启后就马上失效了,没有48小时有效期

mogody avatar Feb 11 '25 06:02 mogody

我目前发现的一个问题,临时token签发后,在服务重启后就马上失效了,没有48小时有效期

对,重启会失效的。每次更新后都要登录。

DreamlingBig avatar Feb 11 '25 06:02 DreamlingBig

我的更离谱 拿到token后(打印出来没问题)的下句请求就返回 token is invalidated

cnazev avatar Apr 15 '25 08:04 cnazev

我的更离谱 拿到token后(打印出来没问题)的下句请求就返回 token is invalidated

看下是不是请求头不对... 不是 Authorization: Bearer eyJhbGciOiJIUzI1N.... 而是 Authorization: eyJhbGciOiJIUzI1N....

JsonSong89 avatar Jun 21 '25 10:06 JsonSong89