Skip to content

Commit 6cf560c

Browse files
Fix: Remove redundant auth header (#107)
1 parent e82578d commit 6cf560c

File tree

3 files changed

+2
-32
lines changed

3 files changed

+2
-32
lines changed

src/lib/api/fetch.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const useCrateClusterHeader = 'X-use-crate';
55
const projectNameHeader = 'X-project';
66
const workspaceNameHeader = 'X-workspace';
77
const mcpNameHeader = 'X-mcp';
8-
const mcpAuthHeader = 'X-mcp-authorization';
98
const contextHeader = 'X-context';
109
const jqHeader = 'X-jq';
1110
const authHeader = 'Authorization';
@@ -39,7 +38,6 @@ export const fetchApiServer = async (
3938
headers[workspaceNameHeader] = config.mcpConfig.workspaceName;
4039
headers[mcpNameHeader] = config.mcpConfig.controlPlaneName;
4140
headers[contextHeader] = config.mcpConfig.contextName;
42-
headers[mcpAuthHeader] = config.mcpConfig.mcpAuthorization;
4341
} else {
4442
headers[useCrateClusterHeader] = 'true';
4543
}

src/lib/api/types/apiConfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ type McpConfig = {
1111
workspaceName: string;
1212
controlPlaneName: string;
1313
contextName: string;
14-
mcpAuthorization: string;
1514
};
1615

1716
//syntax basically combines all the atrributes from the types into one

src/lib/shared/McpContext.tsx

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
import {
2-
createContext,
3-
ReactNode,
4-
useContext,
5-
useEffect,
6-
useState,
7-
} from 'react';
1+
import { createContext, ReactNode, useContext } from 'react';
82
import { ControlPlane as ManagedControlPlaneResource } from '../api/types/crate/controlPlanes.ts';
93
import { GetAuthPropsForContextName } from '../oidc/shared.ts';
10-
import { AuthProvider, hasAuthParams, useAuth } from 'react-oidc-context';
4+
import { AuthProvider } from 'react-oidc-context';
115
import {
126
ApiConfigContext,
137
ApiConfigProvider,
@@ -66,29 +60,9 @@ export const McpContextProvider = ({ children, context }: Props) => {
6660
};
6761

6862
function RequireDownstreamLogin(props: { children?: ReactNode }) {
69-
const auth = useAuth();
7063
const mcp = useContext(McpContext);
71-
const [hasTriedSignin, setHasTriedSignin] = useState(false);
7264
const parentApiConfig = useContext(ApiConfigContext);
7365

74-
// automatically sign-in
75-
useEffect(() => {
76-
if (
77-
!hasAuthParams() &&
78-
!auth.isAuthenticated &&
79-
!auth.activeNavigator &&
80-
!auth.isLoading &&
81-
!hasTriedSignin
82-
) {
83-
auth.signinPopup().then((_) => {
84-
setHasTriedSignin(true);
85-
});
86-
}
87-
}, [auth, hasTriedSignin]);
88-
89-
if (!auth.isAuthenticated || auth.isLoading) {
90-
return <>Elevating your permissions</>;
91-
}
9266
return (
9367
<>
9468
<ApiConfigProvider
@@ -100,7 +74,6 @@ function RequireDownstreamLogin(props: { children?: ReactNode }) {
10074
projectName: mcp.project,
10175
workspaceName: mcp.workspace,
10276
controlPlaneName: mcp.name,
103-
mcpAuthorization: auth.user?.access_token ?? '',
10477
},
10578
}}
10679
>

0 commit comments

Comments
 (0)