docs: 将Token有效期从24小时更新为48小时
更新所有相关API文档及登录接口实现,将Token有效期从24小时延长至48小时,以改善管理员用户体验。
This commit is contained in:
@@ -46,14 +46,14 @@ export const adminLogin = async (c: Context<{ Bindings: Bindings }>) => {
|
|||||||
// 生成 Token (你的 tempKey)
|
// 生成 Token (你的 tempKey)
|
||||||
const tempKey = crypto.randomUUID();
|
const tempKey = crypto.randomUUID();
|
||||||
|
|
||||||
// 将 Token 存入 KV,有效期 24 小时(86400秒)
|
// 将 Token 存入 KV,有效期 48 小时(172800秒)
|
||||||
await c.env.CWD_AUTH_KV.put(
|
await c.env.CWD_AUTH_KV.put(
|
||||||
`token:${tempKey}`,
|
`token:${tempKey}`,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
user: data.name,
|
user: data.name,
|
||||||
ip: ip,
|
ip: ip,
|
||||||
}),
|
}),
|
||||||
{ expirationTtl: 86400 }
|
{ expirationTtl: 172800 }
|
||||||
);
|
);
|
||||||
|
|
||||||
return c.json({
|
return c.json({
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Authorization: Bearer <token>
|
Authorization: Bearer <token>
|
||||||
```
|
```
|
||||||
|
|
||||||
Token 通过登录接口获取,有效期为 24 小时。
|
Token 通过登录接口获取,有效期为 48 小时。
|
||||||
|
|
||||||
## 接口分类
|
## 接口分类
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Authorization: Bearer <token>
|
Authorization: Bearer <token>
|
||||||
```
|
```
|
||||||
|
|
||||||
Token 通过登录接口获取,有效期为 24 小时。
|
Token 通过登录接口获取,有效期为 48 小时。
|
||||||
|
|
||||||
## 1.1 管理员登录
|
## 1.1 管理员登录
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ CWD 评论部署成功,当前版本...
|
|||||||
Authorization: Bearer <token>
|
Authorization: Bearer <token>
|
||||||
```
|
```
|
||||||
|
|
||||||
Token 通过登录接口获取,有效期为 24 小时,服务端会在 KV 中存储会话信息并在每次请求时进行校验。
|
Token 通过登录接口获取,有效期为 48 小时,服务端会在 KV 中存储会话信息并在每次请求时进行校验。
|
||||||
|
|
||||||
## HTTP 状态码
|
## HTTP 状态码
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user