Files
sage-graphql-mcp/src/auth/index.ts
2026-03-13 15:00:22 +00:00

20 lines
511 B
TypeScript

import type { X3Config } from "../types/index.js";
import { generateJWT } from "./jwt.js";
export async function getAuthHeaders(
config: X3Config,
): Promise<Record<string, string>> {
const headers: Record<string, string> = {
"Content-Type": "application/json",
};
if (config.mode === "authenticated") {
headers["Authorization"] = `Bearer ${await generateJWT(config)}`;
headers["x-xtrem-endpoint"] = config.endpoint ?? "";
}
return headers;
}
export { generateJWT } from "./jwt.js";