fix(auth): Support fallback OAuth token and prefixless credential lookups in session state#5899
fix(auth): Support fallback OAuth token and prefixless credential lookups in session state#5899tonycoco wants to merge 1 commit into
Conversation
|
Response from ADK Triaging Agent Hello @tonycoco, thank you for creating this PR! This PR is a bug fix for #4712, but we noticed that it is missing some information required by our contribution guidelines:
Providing this information will help reviewers process and review your PR much more efficiently. Thank you for your contribution! |
2642ad0 to
b62b7b3
Compare
|
@xuanyang15 can you take a look at this one for Gemini Enterprise deployments with Google API Toolset integrations? |
|
Hi @tonycoco, Thank you for your contribution! We appreciate you taking the time to submit this pull request. |
7422804 to
373fddb
Compare
|
/adk-pr-analyze |
|
I am reading the Title: fix(auth): Support fallback OAuth token and prefixless credential lookups in session state Executive Summary
Detailed Findings & Analysis1. Objectives & Impact ("What does it do?")
2. Justification & Value ("Is it a valid and useful change?")
3. Principle & Style Alignment Checklist ("Does it follow rules?")
Summary of Work Done
Please let me know if you would like me to conduct any further checks on this pull request! |
…kups in session state Session state might store authentication responses as raw string tokens instead of AuthCredential objects, or under custom credential keys without the standard "temp:" prefix. Add robust fallback handling to resolve raw token strings, check for prefixless keys, and scan state values for any Google OAuth access tokens starting with "ya29."
373fddb to
8588fcf
Compare
Fixes #4712
Session state might store authentication responses as raw string tokens instead of AuthCredential objects, or under custom credential keys without the standard "temp:" prefix.
Add robust fallback handling to resolve raw token strings, check for prefixless keys, and scan state values for any Google OAuth access tokens starting with "ya29."
The patch updates the
get_auth_responsemethod ingoogle/adk/auth/auth_handler.pyto do the following:Check
temp:<key>prefix: This maintains the standard OAuth redirection flow.Check
<key>directly: This allows resolving credentials where the application or environment provides them under the exact configuration key without prefixes.Scan session state for OAuth tokens: This dynamically scans the state dictionary for active Google Cloud access tokens starting with the standard
"ya29."prefix. This is common in hosted Google Cloud environments such as Vertex AI Reasoning Engine.Unit Tests:
Checklist