修复中控内嵌:跨站 Cookie 被拦时用 embed_sso 维持登录。
SSO 写入 sessionStorage,fetch 自动带 X-Hub-Embed-SSO,避免期权链 API 401。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -44,6 +44,17 @@ def _api_login_required(hub_token_write_allowed: bool = False):
|
||||
|
||||
# crypto_okx 可无 lib.hub;鉴权与中控 request_allowed 对齐
|
||||
allowed = bool(auth_disabled or logged_in)
|
||||
if not allowed:
|
||||
try:
|
||||
from lib.hub.hub_bridge_auth import hub_embed_sso_ok
|
||||
|
||||
if hub_embed_sso_ok(request):
|
||||
session["logged_in"] = True
|
||||
session.permanent = True
|
||||
session.modified = True
|
||||
allowed = True
|
||||
except Exception:
|
||||
pass
|
||||
if not allowed and hub_hdr and bridge and hub_hdr == bridge:
|
||||
allowed = True
|
||||
if not allowed:
|
||||
|
||||
Reference in New Issue
Block a user