Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#7,265 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
authentication, security

Hướng nghiên cứu

Bắt đầu trong src/google/adk/auth/oauth2_discovery.py tại OAuth2DiscoveryManager.discover_auth_server_metadata, được liên kết trong issue, và kiểm tra cách issuer được trả về được so sánh với URL đã cung cấp. Tái hiện phản hồi discovery với dấu gạch chéo ở cuối và xác minh rằng metadata khớp được trả về; hoàn tất khi các URL issuer theo kiểu FastMCP không còn khiến discovery thất bại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
}
Ngôn ngữ chính
Python
Star
21.6k
Fork
4k
Merge trung bình
7 giờ 10 phút
Pull request đã merge (30 ngày)
7

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của google/adk-python

Tất cả issue của google/adk-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.