更新授权回调传参
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 44s

This commit is contained in:
kk
2026-07-11 11:37:53 +08:00
parent 45147426e0
commit 258fa4a9f5
3 changed files with 42 additions and 23 deletions
+13 -3
View File
@@ -47,9 +47,19 @@
if (code) {
// 有 code → 进入授权 Loading 页处理
// redirect_uri 已携带 device_id 和 action,回调时直接从 URL 取
const action = urlParams.get('action') || '';
const callbackDeviceId = urlParams.get('device_id') || deviceId || '';
// 从 state 中解析 device_id 和 actionOAuth 标准保证 state 原样回传)
let action = '';
let callbackDeviceId = deviceId || '';
try {
const stateStr = urlParams.get('state');
if (stateStr) {
const stateObj = JSON.parse(decodeURIComponent(stateStr));
action = stateObj.action || action;
callbackDeviceId = stateObj.device_id || callbackDeviceId;
}
} catch (_) {
// state 解析失败,忽略
}
let loadingUrl = '/pages/auth/loading?code=' + encodeURIComponent(code);
if (action) {
loadingUrl += '&action=' + action;