Skip to content

Commit 6b64061

Browse files
committed
Fix Bearer double-prefix in googleadk auth fallback
googleadk unconditionally prepended 'Bearer' in the shared-token fallback path, producing 'Bearer Bearer <token>' when the caller already included the prefix. Apply the same guard used in the other three extensions.
1 parent 5e91a28 commit 6b64061

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

libraries/microsoft-agents-a365-tooling-extensions-googleadk/microsoft_agents_a365/tooling/extensions/googleadk/services/mcp_tool_registration_service.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ async def add_tool_servers_to_agent(
133133
# BEARER_TOKEN* env vars, or legacy V1 callers).
134134
if Constants.Headers.AUTHORIZATION not in server_headers and auth_token:
135135
server_headers[Constants.Headers.AUTHORIZATION] = (
136-
f"{Constants.Headers.BEARER_PREFIX} {auth_token}"
136+
auth_token
137+
if auth_token.lower().startswith(
138+
f"{Constants.Headers.BEARER_PREFIX.lower()} "
139+
)
140+
else f"{Constants.Headers.BEARER_PREFIX} {auth_token}"
137141
)
138142
headers = {**base_headers, **server_headers} # per-audience token takes precedence
139143

0 commit comments

Comments
 (0)