This commit is contained in:
+13
-3
@@ -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 和 action(OAuth 标准保证 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;
|
||||
|
||||
Reference in New Issue
Block a user