Skip to content

Commit 8ef6707

Browse files
committed
empty teams list fix
Signed-off-by: Keval Mahajan <mahajankeval23@gmail.com>
1 parent 2d6d3c3 commit 8ef6707

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mcpgateway/auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,11 @@ async def get_team_from_token(payload: Dict[str, Any], db: Session) -> Optional[
102102
'team_456'
103103
>>> del sys.modules["mcpgateway.services.team_management_service"]
104104
"""
105-
team_id = payload.get("teams", [None])[0]
105+
team_id = payload.get("teams")[0] if payload.get("teams") else None
106106
if isinstance(team_id, dict):
107107
team_id = team_id.get("id")
108108
user_email = payload.get("sub")
109+
109110
# If no team found in token, get user's personal team
110111
if not team_id:
111112

0 commit comments

Comments
 (0)