fix(mcp): add auth token for hub calls

This commit is contained in:
Chris Christiansen 2026-09-05 21:53:31 +00:00
parent 2fad8e1808
commit b1e8e4156e

View File

@ -90,10 +90,15 @@ async def _verify_auth(request: Request) -> None:
if not token or token != secret:
raise HTTPException(status_code=401, detail="Invalid or missing API key")
def _agent_headers() -> dict:
"""Headers for maskin-til-maskin kall videre til osvauco-agent via X-Internal-Key."""
"""Headers for maskin-til-maskin kall videre til osvauco-agent."""
token = google.oauth2.id_token.fetch_id_token(
google.auth.transport.requests.Request(),
os.environ["OSVAUCO_AGENT_URL"],
)
return {
"X-Internal-Key": INTERNAL_API_KEY, # Bruker den nye delte nøkkelen
"Content-Type": "application/json"
"Authorization": f"Bearer {token}",
"X-Internal-Key": INTERNAL_API_KEY,
"Content-Type": "application/json",
}
async def _agent_get(path: str) -> Any: