Skip to content

Commit a135403

Browse files
committed
Dev mode (manifest): _attach_dev_tokens() runs, OBO never fires regardless of what auth context the extension passes
Prod mode (gateway): OBO runs only when auth context is present
1 parent 4cb88c9 commit a135403

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,18 @@ async def list_tool_servers(
135135
# Determine configuration source based on environment
136136
if self._is_development_scenario():
137137
servers = self._load_servers_from_manifest()
138+
# _attach_dev_tokens() already ran inside _load_servers_from_manifest().
139+
# No OBO exchange in dev: env vars (BEARER_TOKEN_* / BEARER_TOKEN) are the
140+
# auth mechanism, and the gateway is not reachable, so per-audience scopes
141+
# are meaningless here.
138142
else:
139143
servers = await self._load_servers_from_gateway(agentic_app_id, auth_token, options)
140-
141-
# Acquire per-audience tokens and attach Authorization headers when auth context provided
142-
if authorization is not None and auth_handler_name is not None and turn_context is not None:
143-
servers = await self._attach_per_audience_tokens(
144-
servers, authorization, auth_handler_name, turn_context
145-
)
144+
# Prod only: acquire per-audience tokens via OBO for each unique server audience.
145+
# V1 servers share the shared ATG token; V2 servers each get their own audience token.
146+
if authorization is not None and auth_handler_name is not None and turn_context is not None:
147+
servers = await self._attach_per_audience_tokens(
148+
servers, authorization, auth_handler_name, turn_context
149+
)
146150

147151
return servers
148152

0 commit comments

Comments
 (0)