From dff8084bbb1963a6a6968e7e7a270d8968312fbd Mon Sep 17 00:00:00 2001 From: xiangsilian Date: Sat, 15 Aug 2026 12:25:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(app):=20dev-token=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=94=B9=E8=B5=B0=E6=97=A0=E9=89=B4=E6=9D=83=E9=80=9A=E9=81=93?= =?UTF-8?q?=EF=BC=88=E8=87=AA=E6=8B=A6=2040100=20=E9=B8=A1=E7=94=9F?= =?UTF-8?q?=E8=9B=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 真机首验即中:loginByDevToken 走了带鉴权的 post(),而 ApiClient 对 未登录一律 40100 短路——登录接口被自己的守卫拦死,UI 表现为 「请先登录」且无解。改走既有 postWithoutAuth。编译门禁无法发现 此类运行时逻辑环,真机验证首个战果。 --- app/entry/src/main/ets/core/AuthStore.ets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/entry/src/main/ets/core/AuthStore.ets b/app/entry/src/main/ets/core/AuthStore.ets index 63b296c..eeac208 100644 --- a/app/entry/src/main/ets/core/AuthStore.ets +++ b/app/entry/src/main/ets/core/AuthStore.ets @@ -77,7 +77,9 @@ export class AuthStore { /** dev-token 登录(本地后端开发通道)。失败由 ApiClient 抛 ApiError。 */ static async loginByDevToken(deviceKey: string): Promise { const req: Record = { 'device_key': deviceKey } - const data = await ApiClient.post('/api/v1/auth/dev-token', req) + // 登录本身不能走带鉴权的 post()——ApiClient 对未登录一律 40100 短路, + // 登录接口会被自己的守卫拦死(鸡生蛋)。必须走无鉴权通道。 + const data = await ApiClient.postWithoutAuth('/api/v1/auth/dev-token', req) await AuthStore.saveTokens(AuthStore.fromWire(data)) }