Skip to content

Commit 8edb266

Browse files
google-genai-botloic-combis
authored andcommitted
fix(auth): remove unneeded OAuth flows
This is related to #5327. `BaseToolset.get_auth_config()` returns `None` by default and removing its overrides in toolsets that don't need OAuth flows to list tools does the job. No regressions in unit tests (`pytest tests/unittests/auth`): ``` ================================================================= 181 passed, 508 warnings in 4.23s ================================================================= ``` PiperOrigin-RevId: 915128706
1 parent 1ca0ba6 commit 8edb266

3 files changed

Lines changed: 0 additions & 31 deletions

File tree

src/google/adk/tools/apihub_tool/apihub_toolset.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,3 @@ def _prepare_toolset(self) -> None:
199199
async def close(self):
200200
if self._openapi_toolset:
201201
await self._openapi_toolset.close()
202-
203-
@override
204-
def get_auth_config(self) -> Optional[AuthConfig]:
205-
"""Returns the auth config for this toolset.
206-
207-
ADK will populate exchanged_auth_credential on this config before calling
208-
get_tools(). The toolset can then access the ready-to-use credential via
209-
self._auth_config.exchanged_auth_credential.
210-
"""
211-
return self._auth_config

src/google/adk/tools/application_integration_tool/application_integration_toolset.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,3 @@ async def get_tools(
289289
async def close(self) -> None:
290290
if self._openapi_toolset:
291291
await self._openapi_toolset.close()
292-
293-
@override
294-
def get_auth_config(self) -> Optional[AuthConfig]:
295-
"""Returns the auth config for this toolset.
296-
297-
ADK will populate exchanged_auth_credential on this config before calling
298-
get_tools(). The toolset can then access the ready-to-use credential via
299-
self._auth_config.exchanged_auth_credential.
300-
"""
301-
return self._auth_config

src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,3 @@ def _parse(self, openapi_spec_dict: Dict[str, Any]) -> List[RestApiTool]:
245245
@override
246246
async def close(self):
247247
pass
248-
249-
@override
250-
def get_auth_config(self) -> Optional[AuthConfig]:
251-
"""Returns the auth config for this toolset.
252-
253-
Note: This returns a copy so any exchanged credentials populated by the ADK
254-
framework do not persist on the toolset instance across invocations.
255-
"""
256-
return (
257-
self._auth_config.model_copy(deep=True) if self._auth_config else None
258-
)

0 commit comments

Comments
 (0)