fix(auth): normalize external accessToken and preserve on empty yUser login
This commit is contained in:
1 parent
44d7304f8e
commit
1847eb9d6a
5 files changed
+53
-20
No files matched your search
+2
-1
@@ -5,6 +5,7 @@ import {
|
||||
getKnowledgeIframeSkin,
|
||||
} from "@/core/strategy/external-links";
|
||||
import { authStorageGet } from "@/core/auth/scoped-storage";
|
||||
import { normalizeExternalAccessToken } from "@/core/auth/external-access-token";
|
||||
import { requestCrudService } from "@/service/request-axios-service";
|
||||
import ExternalIframePage from "../common/ExternalIframePage";
|
||||
|
||||
@@ -24,7 +25,7 @@ const KnowledgeBaseResourceManagement: React.FC = () => {
|
||||
|
||||
try {
|
||||
const userInfo = JSON.parse(jsonStr);
|
||||
const token = userInfo.accessToken;
|
||||
const token = normalizeExternalAccessToken(userInfo?.accessToken);
|
||||
if (!token) return;
|
||||
|
||||
const res = (await service.post(apiUrl, {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import type { LightApp, LightAppRouteParam } from "@/strategy-components/api/light-apps";
|
||||
import { authStorageGet } from "@/core/auth/scoped-storage";
|
||||
import { normalizeExternalAccessToken } from "@/core/auth/external-access-token";
|
||||
|
||||
/** iframe 可挂载的父菜单(取自 core/page-layout/sidebar-menu.ts 的现有菜单 id)。 */
|
||||
export const MOUNT_OPTIONS: { label: string; value: string }[] = [
|
||||
@@ -142,6 +143,9 @@ export function resolveRouteParamValue(
|
||||
}
|
||||
if (param.source) {
|
||||
const value = userInfo[param.source];
|
||||
if (param.source === "accessToken") {
|
||||
return normalizeExternalAccessToken(value);
|
||||
}
|
||||
return value == null ? "" : String(value);
|
||||
}
|
||||
return "";
|
||||
|
||||
Reference in new issue
Block a user