Skip to content

fix: refresh_token_bug - #828

Closed
GIS142857 wants to merge 1 commit into
go-admin-team:masterfrom
GIS142857:fix-Issues#820
Closed

fix: refresh_token_bug#828
GIS142857 wants to merge 1 commit into
go-admin-team:masterfrom
GIS142857:fix-Issues#820

Conversation

@GIS142857

Copy link
Copy Markdown

[中文版模板 / Chinese template]

🤔 This is a ...

  • Bug fix

🔗 Related issue link

💡 Background and solution

fix refresh_token bug: The methods for the frontend and backend interfaces do not correspond.

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript's definition is updated/provided or not needed
  • Changelog is provided or not needed

@wenjianzhang

Copy link
Copy Markdown
Member

感谢提交,这个接口确实是坏的,但情况比 PR 描述的更复杂一些。

核实后发现前后端的路径与方法都不匹配

后端:GET  /api/v1/refresh_token     app/admin/router/sys_router.go:73
前端:POST /refreshtoken             go-admin-ui/src/api/user.js:21

因此只把后端方法改成 POST 并不能修复——路径仍然对不上,调用照样 404。另外该路由已登记在 common/middleware/settings.goCasbinExclude 白名单里(以 GET 匹配),改动后端方法还需同步调整白名单。

故改为统一以后端现有路由为准,在前端侧修正:go-admin-ui#257。

顺带说明一个相关的上游缺陷(issue #820):go-admin-coreRefreshToken 会把 orig_iat 重置为当前时间,而 CheckIfTokenExpire 正是依据 orig_iatMaxRefresh 判断能否刷新,二者相互抵消——业务 token 可借此无限续期,MaxRefresh = 1h 形同虚设。该逻辑在 sdk/pkg/jwtauth/jwtauth.go,最新的 v1.6.6 仍未修复,需要在上游仓库解决。在此之前不会启用自动续期。

予以关闭,感谢指出这个问题。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants