openyida 2026.7.17-2 → 2026.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/auth/token-auth.js +5 -14
- package/package.json +1 -1
package/lib/auth/token-auth.js
CHANGED
|
@@ -156,10 +156,6 @@ function getTokenPayload(response) {
|
|
|
156
156
|
|
|
157
157
|
function normalizeTokenResponse(response, baseUrl, clientId) {
|
|
158
158
|
const data = getTokenPayload(response);
|
|
159
|
-
const resolvedBaseUrl = normalizeBaseUrl(
|
|
160
|
-
data.base_url || data.baseUrl || baseUrl,
|
|
161
|
-
baseUrl
|
|
162
|
-
);
|
|
163
159
|
return {
|
|
164
160
|
auth_mode: 'token',
|
|
165
161
|
status: data.status || 'ok',
|
|
@@ -170,7 +166,7 @@ function normalizeTokenResponse(response, baseUrl, clientId) {
|
|
|
170
166
|
refresh_token: data.refresh_token || data.refreshToken,
|
|
171
167
|
expires_in: data.expires_in || data.expiresIn,
|
|
172
168
|
expires_at: data.expires_at || data.expiresAt,
|
|
173
|
-
base_url:
|
|
169
|
+
base_url: baseUrl,
|
|
174
170
|
client_id: data.client_id || data.clientId || clientId,
|
|
175
171
|
corp_id: data.corp_id || data.corpId,
|
|
176
172
|
user_id: data.user_id || data.userId,
|
|
@@ -348,14 +344,9 @@ async function tokenRefresh(options = {}) {
|
|
|
348
344
|
};
|
|
349
345
|
}
|
|
350
346
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const authBaseUrlValue = resolveTokenBaseUrl({
|
|
355
|
-
projectRoot: options.projectRoot,
|
|
356
|
-
endpoint: options.endpoint,
|
|
357
|
-
});
|
|
358
|
-
const authBaseUrl = appendPath(authBaseUrlValue, DEFAULT_AUTH_PATH_PREFIX);
|
|
347
|
+
const baseUrl = normalizeBaseUrl(options.endpoint || options.baseUrl || session.base_url, null) ||
|
|
348
|
+
resolveTokenBaseUrl(options);
|
|
349
|
+
const authBaseUrl = appendPath(baseUrl, DEFAULT_AUTH_PATH_PREFIX);
|
|
359
350
|
const clientId = options.clientId || session.client_id || DINGTALK_OAUTH_CLIENT_ID;
|
|
360
351
|
const response = await requestJson('POST', appendPath(authBaseUrl, '/refresh'), {
|
|
361
352
|
refreshToken: session.refresh_token,
|
|
@@ -369,7 +360,7 @@ async function tokenRefresh(options = {}) {
|
|
|
369
360
|
user_id: data.user_id || data.userId || session.user_id,
|
|
370
361
|
user_name: data.user_name || data.userName || session.user_name,
|
|
371
362
|
refresh_token: data.refresh_token || data.refreshToken || session.refresh_token,
|
|
372
|
-
},
|
|
363
|
+
}, baseUrl, clientId);
|
|
373
364
|
if (!normalized.access_token) {
|
|
374
365
|
return {
|
|
375
366
|
...normalized,
|