Skip to content

Commit

Permalink
update: 登录刷新接口完善
Browse files Browse the repository at this point in the history
  • Loading branch information
Binaryify committed Apr 6, 2022
1 parent 81a218a commit 78640ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ v3.30.0 后支持手动传入 cookie,登录接口返回内容新增 `cookie` 字

### 刷新登录

说明 : 调用此接口 , 可刷新登录状态
说明 : 调用此接口 , 可刷新登录状态,返回内容包含新的cookie(不支持刷新二维码登录的cookie)

**调用例子 :** `/login/refresh`

Expand Down
15 changes: 13 additions & 2 deletions module/login_refresh.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 登录刷新

module.exports = (query, request) => {
return request(
module.exports = async (query, request) => {
let result = await request(
'POST',
`https://music.163.com/weapi/login/token/refresh`,
{},
Expand All @@ -13,4 +13,15 @@ module.exports = (query, request) => {
realIP: query.realIP,
},
)
if (result.body.code === 200) {
result = {
status: 200,
body: {
...result.body,
cookie: result.cookie.join(';'),
},
cookie: result.cookie,
}
}
return result
}

0 comments on commit 78640ff

Please sign in to comment.