@modelcontextprotocol/inspector-client 0.2.7 → 0.4.0
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.
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports, S as SESSION_KEYS, h as handleOAuthCallback } from "./index-DjoEM10P.js";
|
|
2
|
+
const OAuthCallback = () => {
|
|
3
|
+
const hasProcessedRef = reactExports.useRef(false);
|
|
4
|
+
reactExports.useEffect(() => {
|
|
5
|
+
const handleCallback = async () => {
|
|
6
|
+
if (hasProcessedRef.current) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
hasProcessedRef.current = true;
|
|
10
|
+
const params = new URLSearchParams(window.location.search);
|
|
11
|
+
const code = params.get("code");
|
|
12
|
+
const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL);
|
|
13
|
+
if (!code || !serverUrl) {
|
|
14
|
+
console.error("Missing code or server URL");
|
|
15
|
+
window.location.href = "/";
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const accessToken = await handleOAuthCallback(serverUrl, code);
|
|
20
|
+
sessionStorage.setItem(SESSION_KEYS.ACCESS_TOKEN, accessToken);
|
|
21
|
+
window.location.href = `/?serverUrl=${encodeURIComponent(serverUrl)}`;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.error("OAuth callback error:", error);
|
|
24
|
+
window.location.href = "/";
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
void handleCallback();
|
|
28
|
+
}, []);
|
|
29
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-gray-500", children: "Processing OAuth callback..." }) });
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
OAuthCallback as default
|
|
33
|
+
};
|