Skip to content

Commit 2d6d3c3

Browse files
gabe-l-hartkevalmahajan
authored andcommitted
fix: Handle the case where the teams list is a list of dicts
#1467 Branch: ResourceCacheInvalidation-1467 Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
1 parent e61b340 commit 2d6d3c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mcpgateway/auth.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ 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")[0] if payload.get("teams") else None
105+
team_id = payload.get("teams", [None])[0]
106+
if isinstance(team_id, dict):
107+
team_id = team_id.get("id")
106108
user_email = payload.get("sub")
107109
# If no team found in token, get user's personal team
108110
if not team_id:

0 commit comments

Comments
 (0)