fix(auth): allow configuring OAuth prompt parameter#5818
Open
RaghunandanKumar wants to merge 1 commit into
Open
fix(auth): allow configuring OAuth prompt parameter#5818RaghunandanKumar wants to merge 1 commit into
RaghunandanKumar wants to merge 1 commit into
Conversation
AuthHandler always sent prompt=consent when generating OAuth authorization URLs, which blocked silent-auth flows even when the tool configuration needed a different prompt mode. Add an optional prompt field to OAuth2Auth, preserve consent as the default, and honor custom values such as prompt=none when building the authorization URL. Extend auth handler tests to cover both the default and a custom override.
|
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. |
Collaborator
|
Response from ADK Triaging Agent Hello @RaghunandanKumar, thank you for creating this PR! We appreciate your contribution to improve the flexibility of OAuth prompt configuration. To help us review and merge your PR more efficiently, please address the following items from our contribution guidelines:
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3046
Summary
AuthHandler.generate_auth_uri()currently hardcodesprompt=consentwhen building OAuth authorization URLs.That makes app-level OAuth configuration less flexible than the underlying providers allow. Flows that need
prompt=none(or another prompt mode) cannot express that throughOAuth2Auth, even though the rest of the OAuth request metadata is already configurable.This change adds an optional
promptfield toOAuth2Auth, preservesconsentas the default, and uses the configured value when generating the authorization URL.Changes
src/google/adk/auth/auth_credential.pypromptfield toOAuth2Auth.src/google/adk/auth/auth_handler.pyauth_credential.oauth2.prompt or "consent"when populating OAuth authorization params.tests/unittests/auth/test_auth_handler.pypromptin generated auth URIs.prompt=consent.prompt="none"override.Test plan
python3.12 -m py_compile src/google/adk/auth/auth_credential.py src/google/adk/auth/auth_handler.py tests/unittests/auth/test_auth_handler.pyPYTHONPATH=src .venv/bin/python -m pytest tests/unittests/auth/test_auth_handler.py -qgoogle.adkfor this test path pulls additional runtime dependencies (google.genai,opentelemetry.semconv, and friends). I stopped after confirming the touched files compile cleanly rather than trying to recreate the repo's fulluv sync --all-extrasenvironment by hand.