modelcontextprotocol / modelcontextprotocol/php-sdk
[Client] Implement refresh_token grant + offline_access scope
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- PHP
- Sterne
- 1.6k
- Forks
- 173
- Ø Merge
- 2 T. 49 Min.
- Gemergte PRs (30 T.)
- 23
Beschreibung
Context
When an access token expires, the client must transparently refresh using the stored refresh_token rather than re-prompting the user. Per OIDC/OAuth, offline_access scope is requested at authorize time when the AS advertises it; otherwise the client degrades gracefully (no refresh available).
Scope
Mcp\Client\Auth\Grant\RefreshTokenGrant.- Pre-flight check: if
expires_at - now() < skew, refresh before sending request. - Reactive: on
401with valid refresh token, refresh + retry once. - Request
offline_accessscope at authorize time whenscopes_supportedcontains it; otherwise omit. - If the AS does not advertise offline_access and tokens expire, surface a re-auth signal cleanly (no infinite loop).
Conformance scenarios unblocked
auth/offline-access-scope, auth/offline-access-not-supported.
Dependencies
Blocked by: #319 (need access+refresh tokens from auth code flow), #322 (scope handling).
Acceptance
- Unit tests for proactive + reactive refresh, no-refresh-token degradation, no-offline_access degradation.
- Conformance: 2 baseline scenarios pass.
cc @soyuka
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit Mcp\Client\Auth\Grant\RefreshTokenGrant und prüfen Sie die Abhängigkeiten #319 und #322 für den Ablauf der Access-/Refresh-Token- und Scope-Verarbeitung. Führen Sie die Conformance-Szenarien auth/offline-access-scope und auth/offline-access-not-supported aus und fügen Sie anschließend die angeforderte Unit-Test-Abdeckung für proaktives und reaktives Refreshing, Degradation und sauberes Re-Authentifizieren hinzu.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- authentication, authorization
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100