From 155f252300d6f7d50324762c44ddd23a89bc5684 Mon Sep 17 00:00:00 2001
From: 18586361686 <1207669650@qq.com>
Date: 星期二, 27 五月 2025 00:01:58 +0800
Subject: [PATCH] feat: iframe 鉴权后端接口,前端使用 url 拼接token,将 token 放入 localstorage 进行鉴权

---
 aiflowy-ui-react/src/pages/ExternalBot.tsx |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/aiflowy-ui-react/src/pages/ExternalBot.tsx b/aiflowy-ui-react/src/pages/ExternalBot.tsx
index 1e39b2c..4876863 100644
--- a/aiflowy-ui-react/src/pages/ExternalBot.tsx
+++ b/aiflowy-ui-react/src/pages/ExternalBot.tsx
@@ -92,6 +92,11 @@
 });
 
 export const ExternalBot: React.FC = () => {
+    const urlParams = new URLSearchParams(location.search);
+    const token = urlParams.get('authKey');
+    if (token) {
+        localStorage.setItem('authKey', token);
+    }
     const [newTitle, setNewTitle] = useState<string>('');
 
     // ==================== Style ====================
@@ -343,4 +348,4 @@
     path: "/ai/externalBot/:id",
     element: ExternalBot,
     frontEnable: true,
-};
\ No newline at end of file
+};

--
Gitblit v1.8.0