Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

OAuth2 Discovery method fails because FastMCP with GoogleProvider (OAuth) returns issuerUrl with trailing slash

未关闭 适合新手
#7,265 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python

调研方向

从 issue 中链接的 src/google/adk/auth/oauth2_discovery.py 里的 OAuth2DiscoveryManager.discover_auth_server_metadata 开始,检查返回的 issuer 如何与提供的 URL 进行比较。复现带有尾部斜杠的 discovery 响应,并验证返回了匹配的元数据;当 FastMCP 风格的 issuer URL 不再导致 discovery 失败时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

The OAuth2DiscoveryManager‎.discover_auth_server_metadata‎ function retrieves a remote MCP Server's discovery document, to initialize the tool's AuthScheme object.
The function compares the returned issuer URL to the provided issuer URL to defend against MIX-UP attacks (as documented):
if metadata.issuer == issuer_url.rstrip("/"):

However, if the returned issuer has a trailing slash ('/'), as is the case when using FastMCP and the GoogleProvider, the function fails to compare the issuer values and no metadata is returned.

The correct code should be:
if metadata.issuer.rstrip("/") == issuer_url.rstrip("/"):

This is an example of what FastMCP is returning when using SSE transport with a GoogleProvider:

{
"issuer": "http://localhost:8080/",
"authorization_endpoint": "http://localhost:8080/authorize",
"token_endpoint": "http://localhost:8080/token",
"registration_endpoint": "http://localhost:8080/register",
"scopes_supported": [
   "openid",
   "https://www.googleapis.com/auth/userinfo.email"
],
"response_types_supported": [
   "code"
],
"grant_types_supported": [
   "authorization_code",
   "refresh_token"
],
"token_endpoint_auth_methods_supported": [
   "client_secret_post",
   "client_secret_basic",
   "private_key_jwt",
   "none"
],
"code_challenge_methods_supported": [
   "S256"
],
"client_id_metadata_document_supported": true
}
主要语言
Python
星标
21.6k
派生
4k
平均合并
7 小时 10 分钟
30 天内合并 PR
7

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/adk-python 的其他 Issue

查看 google/adk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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