Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

fix: Store raw JWT in auth cookie (strip 'Bearer ') (#1376)

Edwin Joseaca507663c1b
diff --git a/src/api/auth.py b/src/api/auth.py
index 04f199b09..060bf0046 100644
--- a/src/api/auth.py
+++ b/src/api/auth.py
@@ -77,9 +77,14 @@ async def auth_callback(
response = JSONResponse(
{k: v for k, v in result.items() if k != "jwt_token"}
)
+ # Store only the raw JWT (without "Bearer " prefix) in the cookie.
+ # The prefix is added by the OpenSearch client when building the Authorization header.
+ jwt_value = result["jwt_token"]
+ if jwt_value.startswith("Bearer "):
+ jwt_value = jwt_value[len("Bearer "):]
response.set_cookie(
key="auth_token",
- value=result["jwt_token"],
+ value=jwt_value,
httponly=True,
secure=False,
samesite="lax",