XThomasBU commited on
Commit
6d6cdc0
·
verified ·
1 Parent(s): 083c759

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -35,15 +35,14 @@ from typing import Dict, Optional
35
  import chainlit as cl
36
 
37
 
38
- @cl.oauth_callback
39
- def oauth_callback(
40
- provider_id: str,
41
- token: str,
42
- raw_user_data: Dict[str, str],
43
- default_user: cl.User,
44
- ) -> Optional[cl.User]:
45
- return default_user
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():