feat (auth): Add Google and Github authentication in chainlit app
Browse files- chainlit_ui.py +13 -1
chainlit_ui.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import chainlit as cl
|
| 2 |
-
import asyncio
|
| 3 |
import logging
|
| 4 |
from typing import Optional
|
| 5 |
|
|
@@ -16,6 +15,19 @@ SESSION_AGENT_KEY = "axiom_agent"
|
|
| 16 |
SESSION_HISTORY_KEY = "chat_history"
|
| 17 |
SESSION_MCP_SERVERS_KEY = "mcp_servers"
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
@cl.on_chat_start
|
| 20 |
async def on_chat_start():
|
| 21 |
|
|
|
|
| 1 |
import chainlit as cl
|
|
|
|
| 2 |
import logging
|
| 3 |
from typing import Optional
|
| 4 |
|
|
|
|
| 15 |
SESSION_HISTORY_KEY = "chat_history"
|
| 16 |
SESSION_MCP_SERVERS_KEY = "mcp_servers"
|
| 17 |
|
| 18 |
+
#################################
|
| 19 |
+
# User Authentication
|
| 20 |
+
#################################
|
| 21 |
+
@cl.oauth_callback
|
| 22 |
+
def oauth_callback(
|
| 23 |
+
provider_id: str,
|
| 24 |
+
token: str,
|
| 25 |
+
raw_user_data: dict[str, str],
|
| 26 |
+
default_user: cl.User,
|
| 27 |
+
) -> Optional[cl.User]:
|
| 28 |
+
|
| 29 |
+
return default_user
|
| 30 |
+
|
| 31 |
@cl.on_chat_start
|
| 32 |
async def on_chat_start():
|
| 33 |
|