Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,15 +35,14 @@ from typing import Dict, Optional
|
|
| 35 |
import chainlit as cl
|
| 36 |
|
| 37 |
|
| 38 |
-
@cl.
|
| 39 |
-
def
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
@cl.on_chat_start
|
| 49 |
async def on_chat_start():
|
|
|
|
| 35 |
import chainlit as cl
|
| 36 |
|
| 37 |
|
| 38 |
+
@cl.header_auth_callback
|
| 39 |
+
def header_auth_callback(headers: Dict) -> Optional[cl.User]:
|
| 40 |
+
# Verify the signature of a token in the header (ex: jwt token)
|
| 41 |
+
# or check that the value is matching a row from your database
|
| 42 |
+
if headers.get("test-header") == "test-value":
|
| 43 |
+
return cl.User(identifier="admin", metadata={"role": "admin", "provider": "header"})
|
| 44 |
+
else:
|
| 45 |
+
return None
|
|
|
|
| 46 |
|
| 47 |
@cl.on_chat_start
|
| 48 |
async def on_chat_start():
|