vumichien commited on
Commit
6e405a0
·
1 Parent(s): 5fa8be0

remove redundant

Browse files
Files changed (1) hide show
  1. custom_auth.py +0 -20
custom_auth.py CHANGED
@@ -6,8 +6,6 @@ from token_store import token_store
6
 
7
 
8
  async def get_token(
9
- request: Request,
10
- authorization: Optional[str] = Header(None, convert_underscores=False),
11
  token: Optional[str] = Query(
12
  None, description="Access token (alternative to Authorization header)"
13
  ),
@@ -16,24 +14,6 @@ async def get_token(
16
  Extract token from Authorization header or query parameter
17
  Supports both methods for better compatibility with various clients
18
  """
19
- # Debug headers
20
- headers = dict(request.headers)
21
- print(f"All headers: {headers}")
22
- print(f"Authorization header from param: {authorization}")
23
- auth_header = headers.get("authorization") or headers.get("Authorization")
24
- print(f"Authorization header from request: {auth_header}")
25
-
26
- # First try to get token from Authorization header
27
- if authorization or auth_header:
28
- # Use the authorization from parameter or from request headers
29
- auth = authorization or auth_header
30
-
31
- # Handle "Bearer" prefix if present
32
- if auth.startswith("Bearer "):
33
- return auth.replace("Bearer ", "").strip()
34
- else:
35
- # If it doesn't have Bearer prefix, use as is
36
- return auth.strip()
37
 
38
  # Then try to get token from query parameter
39
  if token:
 
6
 
7
 
8
  async def get_token(
 
 
9
  token: Optional[str] = Query(
10
  None, description="Access token (alternative to Authorization header)"
11
  ),
 
14
  Extract token from Authorization header or query parameter
15
  Supports both methods for better compatibility with various clients
16
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  # Then try to get token from query parameter
19
  if token: