Repository navigation
fix(bangumi): 网页控制台账号登录修复 app_nonexistence(授权表单 action 为空) - #100
Merged
Merged
Conversation
Bangumi 的 /oauth/authorize 表单没有 action 属性,client_id/response_type/redirect_uri/state 都在页面 URL 的查询串里;浏览器会把空 action 表单提交回当前 URL。原来的解析把空 action 兜底成 /oauth/authorize,POST 丢掉查询串后 Bangumi 返回 app_nonexistence,网页控制台账号登录永远失败。 真机(HK1,debug 包注入发版 client id/secret)验证:/start -> 验证码 -> 测试账号 -> success,tokenConfigured=true,7 天有效期。单测 5/5 绿;回退主代码则 2 个用例红。
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
现象
网页控制台(WebUI)「元数据 → 使用账号登录」提交邮箱/密码/验证码后,电视端弹裸的
app_nonexistence,无法完成登录。同一个授权 URL 在浏览器里能正常出授权页,说明应用注册、client_id、redirect_uri 都没有问题。根因
Bangumi 的
/oauth/authorize授权页渲染的表单没有action属性,client_id / response_type / redirect_uri / state全在页面 URL 的查询串里;浏览器对空 action 表单会「提交回当前 URL」。BangumiPasswordLoginClient.parseAuthorizeForm()把空 action 兜底成"/oauth/authorize",POST 到裸路径后response_type/state丢失,Bangumi 判定为无效授权请求,渲染通用错误页呜咕,出错了 / app_nonexistence。修复
parseAuthorizeForm:保留空 action,不再兜底成/oauth/authorize;loginAndAuthorize:action 为空时直接回提交到授权页 URL(带查询串);action 非空时按浏览器语义相对授权页 URL 解析(新增resolveAgainst);client_id/response_type/state查询串。验证
协议层(真实站点 + 测试账号 + 发版包内置凭据,走电视同一条出站代理)
/oauth/authorize(修复前行为)app_nonexistence?code=…&state=…Android TV 真机(debug 包注入发版凭据)
单测:
:scraper-core:test5/5 绿;回退主代码改动后 2 个用例红(回归有效)。说明 / 未覆盖