Skip to content

MCPToolset: Add OAuth2 Client Credentials Flow with RFC 8414 Compliant Discovery #2061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,28 @@
* Added unit test coverage for local_eval_sets_manager.py ([174afb3](https://github.com/google/adk-python/commit/174afb3975bdc7e5f10c26f3eebb17d2efa0dd59))
* Extract common options for `adk web` and `adk api_server` ([01965bd](https://github.com/google/adk-python/commit/01965bdd74a9dbdb0ce91a924db8dee5961478b8))

## [Unreleased]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG is only updated up on release. please put those information in the message.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do!


### Added
- **OAuth2 Client Credentials Flow Support**: Added comprehensive support for OAuth2 client credentials flow across ADK authentication infrastructure
- Enhanced `OAuth2CredentialExchanger` to detect and handle client credentials flow automatically
- Updated `OAuth2CredentialRefresher` to properly refresh client credentials tokens (by re-exchange)
- Improved `create_oauth2_session` utility to support client credentials session creation
- Enhanced `OAuthGrantType.from_flow()` method with better flow detection and documentation
- MCPToolset now supports OAuth2 client credentials authentication out-of-the-box
- Added comprehensive unit tests for client credentials functionality
- Added example usage in MCP stdio server agent sample

### Changed
- `OAuth2CredentialExchanger.exchange()` now supports both authorization code and client credentials flows
- `OAuth2CredentialRefresher.refresh()` automatically detects grant type and uses appropriate refresh strategy
- `OAuthGrantType.from_flow()` return type changed to `Optional[OAuthGrantType]` for better type safety

### Technical Details
- Client credentials flow prioritized over authorization code when both are configured
- Automatic token exchange without user interaction for machine-to-machine authentication
- Proper error handling and fallback for unsupported or misconfigured flows

## 1.1.1

### Features
Expand Down
Loading