fix(backend): Refactor OIDC callback and auth dependency to correctly handle cookies and prefix all API routes with /api/v1.

This commit is contained in:
Yunxiao Xu
2026-02-12 01:26:28 -08:00
parent 49a9da7c0c
commit 0dfdef738d
6 changed files with 51 additions and 29 deletions

View File

@@ -21,7 +21,7 @@ def auth_header(mock_user):
def test_stream_agent_unauthorized():
"""Test that streaming requires authentication."""
response = client.post("/chat/stream", json={"message": "hello"})
response = client.post("/api/v1/chat/stream", json={"message": "hello"})
assert response.status_code == 401
@pytest.mark.asyncio
@@ -52,7 +52,7 @@ async def test_stream_agent_success(auth_header, mock_user):
mock_session.get.return_value = mock_conv
# Using TestClient with a stream context
with client.stream("POST", "/chat/stream",
with client.stream("POST", "/api/v1/chat/stream",
json={"message": "hello", "thread_id": "t1"},
headers=auth_header) as response:
assert response.status_code == 200