Skip to content

Support HTTP Basic auth for OpenAPI tools#5535

Open
Oppong08 wants to merge 2 commits intogoogle:mainfrom
Oppong08:fix/openapi-basic-auth-5492
Open

Support HTTP Basic auth for OpenAPI tools#5535
Oppong08 wants to merge 2 commits intogoogle:mainfrom
Oppong08:fix/openapi-basic-auth-5492

Conversation

@Oppong08
Copy link
Copy Markdown

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

2. Or, if no issue exists, describe the change:

N/A

Problem:
OpenAPI tools currently do not support HTTP Basic authentication. When an OpenAPI auth credential contains HTTP username/password credentials, ADK raises NotImplementedError("Basic Authentication is not supported.") instead of generating a standard Basic auth Authorization header.

Solution:
Add HTTP Basic auth support in credential_to_param by mirroring the existing bearer-token handling pattern. When HTTP credentials contain a username and/or password, the helper now encodes username:password with base64 and returns an internal Authorization header in the format Basic <base64(username:password)>. This keeps the change small, localized, and consistent with the current auth helper design.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Passed locally:

  • pytest tests/unittests/tools/openapi_tool/auth/test_auth_helper.py

Manual End-to-End (E2E) Tests:

Manual verification performed by exercising the auth helper path locally and confirming that HTTP Basic auth credentials now produce an internal Authorization header parameter and kwargs instead of raising NotImplementedError.

Relevant behavior verified:

  • username + password generates Authorization: Basic <base64(username:password)>
  • existing non-Basic auth paths remain unchanged

Additional commands run:

  • pre-commit run --all-files

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

This change is intentionally minimal:

  • adds base64 import
  • replaces the unsupported HTTP Basic auth branch in src/google/adk/tools/openapi_tool/auth/auth_helpers.py
  • updates tests/unittests/tools/openapi_tool/auth/test_auth_helper.py

The implementation preserves existing behavior for non-Basic auth paths.

Add any other context or screenshots about the feature request here.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 28, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Apr 28, 2026
@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented Apr 28, 2026

Response from ADK Triaging Agent

Hello @Oppong08, thank you for creating this PR!

It looks like you haven't signed the Contributor License Agreement (CLA) yet. Please visit https://cla.developers.google.com/ to sign it.

Once the CLA is signed, the reviewers will be able to proceed with reviewing your PR. Thanks!

@Oppong08 Oppong08 force-pushed the fix/openapi-basic-auth-5492 branch from a8fade8 to 3e8a603 Compare April 28, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support HTTP Basic authentication for OpenAPI tools

2 participants