fix(easo): JWT 响应字段名为 id 而非 value,增加空值保护

This commit is contained in:
gitea committed 2026-04-17 09:56:32 +08:00
1 parent ad374d604f
commit 9942ab63b9
1 file changed
+4 -2
+4 -2
View File
@@ -4,7 +4,7 @@
区别:EASO 工作流子域使用 Bearer JWT 认证,域名固定为 unity.ekuaibao.com。
Bearer JWT 通过快报主站接口换取:
GET /api/engine/realm/$EASO/actions/jwt → {"value": "<token>"}
GET /api/engine/realm/$EASO/actions/jwt → {"id": "<token>"}
使用方:services/platform/workflow_service 通过 get_easo_client() 获取实例,
并在 _cmd 函数中以 with 上下文管理器管理生命周期。
@@ -83,7 +83,9 @@ def get_easo_client() -> EasoClient:
with get_client() as ekb:
raw = ekb.get("/engine/realm/$EASO/actions/jwt")
bearer = raw.get("value", "")
bearer = raw.get("id") or raw.get("value", "")
if not bearer:
raise ApiResponseError(0, f"EASO JWT 换取失败,响应结构异常:{raw}")
return EasoClient(
corp_id=corp_id,