fix(mcp): add auth token for hub calls
This commit is contained in:
parent
2fad8e1808
commit
b1e8e4156e
|
|
@ -90,10 +90,15 @@ async def _verify_auth(request: Request) -> None:
|
||||||
if not token or token != secret:
|
if not token or token != secret:
|
||||||
raise HTTPException(status_code=401, detail="Invalid or missing API key")
|
raise HTTPException(status_code=401, detail="Invalid or missing API key")
|
||||||
def _agent_headers() -> dict:
|
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 {
|
return {
|
||||||
"X-Internal-Key": INTERNAL_API_KEY, # Bruker den nye delte nøkkelen
|
"Authorization": f"Bearer {token}",
|
||||||
"Content-Type": "application/json"
|
"X-Internal-Key": INTERNAL_API_KEY,
|
||||||
|
"Content-Type": "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
async def _agent_get(path: str) -> Any:
|
async def _agent_get(path: str) -> Any:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user