django-vue3-admin-web/node_modules/@smithy/shared-ini-file-loader/dist-es/getSSOTokenFromFile.js
2025-10-20 21:21:14 +08:00

13 lines
456 B
JavaScript

import { promises as fsPromises } from "fs";
import { getSSOTokenFilepath } from "./getSSOTokenFilepath";
const { readFile } = fsPromises;
export const tokenIntercept = {};
export const getSSOTokenFromFile = async (id) => {
if (tokenIntercept[id]) {
return tokenIntercept[id];
}
const ssoTokenFilepath = getSSOTokenFilepath(id);
const ssoTokenText = await readFile(ssoTokenFilepath, "utf8");
return JSON.parse(ssoTokenText);
};