Repository navigation
修复小程序登录接口的 token 依赖并支持无 token 请求 - #4140
Open
binarywang wants to merge 1 commit into
Open
binarywang wants to merge 1 commit into
binarywang wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🤖 Augment PR Summary概要:修复小程序登录对
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
🟡 Changes recommended
通用无 token 请求会被错误记录为 code2Session 请求,需修正诊断日志语义。
1 open finding
What changed in this PR
修复小程序登录接口对 access_token 的非必要依赖,并新增通用无 token 请求能力。
Changes:
jscode2session改用无 token 请求路径。- 新增无 token GET、POST 和自定义执行接口。
- 补充四种 HTTP 客户端及重试、账号切换测试。
| File | Description |
|---|---|
WxMaService.java |
定义无 token 请求公共 API。 |
BaseWxMaServiceImpl.java |
实现无 token 执行、主机替换与重试。 |
WxMaCode2SessionSecurityTest.java |
验证登录和无 token 请求行为。 |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+410
to
+411
| return this.executeInternal(executor, uri, dataForLog, false, | ||
| !withToken || JSCODE_TO_SESSION_URL.equals(uri), withToken); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

小程序
jscode2session无需 access_token,但现有登录封装会先获取 token 并拼接到请求中,导致登录依赖不必要的 token 获取过程。本次让jsCode2SessionInfo()(及委托它的getSessionInfo())改走无 token 请求路径。新增
getWithoutToken()、postWithoutToken()和executeWithoutToken()。内置 HTTP 实现保留 API 主机配置、系统繁忙重试和敏感信息日志保护;无 token 请求不会刷新或使缓存 token 过期。接口通过 Java 8 默认方法扩展,普通请求的 token 处理保持原有行为。验证:15 项相关测试通过,覆盖 Apache HttpClient、HttpComponents、OkHttp、Jodd 的登录及无 token GET/POST,以及重试上限、异常、账号切换和普通 token 刷新。
git diff --check通过。mvn -pl weixin-java-miniapp -am -Dmaven.test.skip=false -Dtest=WxMaCode2SessionSecurityTest,WxMaSignaturePayloadTest,WxMaUserServiceImplCheckSessionKeyTest,WxMaUserServiceImplPhoneNumberTest -Dsurefire.failIfNoSpecifiedTests=false test未执行需要微信凭据的全量集成测试。
Fixes #4138