a2aproject / a2aproject/a2a-samples

bug: `_store_user_auth()` is never called after OAuth flow completes in `calendar_agent/adk_agent_executor.py`

未关闭
#275 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
1.8k
派生
751
PR 合并指标
30 天内没有已合并 PR

描述

### What happened?

The `_store_user_auth()` method in calendar_agent/adk_agent_executor.py (around [L213–L219](https://github.com/a2aproject/a2a-samples/blob/main/samples/python/agents/birthday_planner_adk/calendar_agent/adk_agent_executor.py#L213-L219)) is never called after the OAuth2 flow completes.

The flow correctly redirects to `/authenticate` and includes a valid `code` parameter, but the call to `_store_user_auth()` is skipped because `context.call_context.user.is_authenticated` remains `False`.

Even after explicitly adding a debug log line at the top of `_store_user_auth()`, the log message is never printed — confirming that the method is not invoked at all.

**What I expected to happen**
After completing the OAuth redirect and receiving the authorization code (`code=...`), I expected the agent to exchange the code for an access token and store the credentials via `_store_user_auth()`.

**How to reproduce the issue**
1. Run the sample agent `birthday_planner_adk/calendar_agent`.
2. Trigger a message that requires calendar access.
3. Complete the OAuth2 flow in the browser.
4. Observe from logs that `_store_user_auth()` is never executed, even if debug logs are inserted into the method.

### Relevant log output

```shell
DEBUG:adk_agent_executor:Skipping event
DEBUG:adk_agent_executor:Yielding auth required response: https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=<...>.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar&state=<...>&access_type=offline&prompt=consent&redirect_uri=http://localhost:10007/authenticate
DEBUG:adk_agent_executor:Waiting for auth event
INFO: ::1:51692 - "GET /authenticate?state=<...>&code=<...>&scope=https://www.googleapis.com/auth/calendar HTTP/1.1" 200 OK
INFO:adk_agent_executor:Auth received, continuing
DEBUG:adk_agent_executor:_complete_auth_processing with auth_content: UserContent(
parts=[
Part(
function_response=FunctionResponse(
id='adk-...',
name='adk_request_credential',
response={...} # Contains no access_token
)
)
]
)
DEBUG:adk_agent_executor:_complete_auth_processing after _process_request context:
INFO:adk_agent_executor:[Calendar] execute exiting
```

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。