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

OAuthClientProvider: no supported way to override endpoints or customize authorization state generation

Đang mở
#3,570 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
65/100
Loại issue
Tính năng
Độ 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
api, authentication, backend

Hướng nghiên cứu

Look at the OAuthClientProvider class in the codebase, likely in a file like oauth_client.py. Examine the _perform_authorization_code_grant method for state generation and the endpoint resolution logic. The work involves adding new optional parameters or hooks, then updating the flow to use them. Test by creating a subclass that overrides the new hook and supplies custom endpoints.

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

Mô tả

Initial Checks
  • I confirm that I'm using the newest release of my line (verified on main and 2.2.0)
  • I confirm that I searched for my issue in the issues before opening this one (searched "custom oauth endpoints", "generate_auth_state", "state hook")
Release line

v2 (v1 shares the code)

Description

Two extensibility gaps in OAuthClientProvider for host applications that manage OAuth at scale (many servers, multi-tenant callbacks):

  1. Endpoint override. The endpoints used by the flow are only ever taken from discovery metadata or hard-coded fallbacks. A host that already knows the correct endpoints (admin-configured connectors, servers with broken or absent RFC 8414 metadata) has no supported way to supply them — subclassing private methods is the only route today. Proposal: an optional OAuthEndpoints value (authorization/token/registration endpoints) accepted by the provider and taking precedence over discovery.

  2. State generation hook. _perform_authorization_code_grant hard-codes state = secrets.token_urlsafe(32). A host that routes many callbacks through one shared redirect endpoint needs to bind the state value to its own session/tenant (e.g. a signed payload) while keeping the SDK's CSRF check. Proposal: an overridable generate_auth_state() hook defaulting to the current behavior.

Both are additive, no behavior change for existing users. We run both in production and can PR them — happy to be assigned.

🤖 Generated with Claude Code

Ngôn ngữ chính
Python
Star
24.3k
Fork
4k
Merge trung bình
1 ngày 16 giờ
Pull request đã merge (30 ngày)
25

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 modelcontextprotocol/python-sdk

Tất cả issue của modelcontextprotocol/python-sdk

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.