[v1.x] startAuthorization sends a second prompt parameter when the authorization endpoint already has one (Brex/Okta and Entra reject the request)

Ouverte
#3,274 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@naufalfx805-source y travaille déjà.

Depuis le 4/12/2026.

  • #3275 par @naufalfx805-source — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
38/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript
Domaine
authentication

Piste de recherche

Read src/client/auth.ts around line 1281 and review PR #1958 for the proposed change. Check how startAuthorization handles prompt when the endpoint already includes one and the scope requests offline_access; done means the authorization URL contains only one prompt parameter. The issue asks for a review and a backport to v1.x, so coordinate with the maintainers before taking it on.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

v1 v2

Summary

startAuthorization adds prompt=consent with searchParams.append whenever the scope contains offline_access. When the authorization server's advertised authorization_endpoint already carries a prompt query parameter, the request goes out with two prompt parameters, and the authorization server rejects it before the sign-in page loads.

RFC 6749 §3.1 allows the endpoint URI to include a query component (which must be kept) and says request parameters "MUST NOT be included more than once".

Still present on both lines today:

  • v1.x: src/client/auth.ts:1281
  • main: packages/client/src/client/auth.ts:2188

(Last published release checked: @modelcontextprotocol/[email protected], dist/esm/client/auth.js:815.)

Two servers that fail today

Server Advertised authorization_endpoint Error
Brex's hosted MCP server (Okta) https://accounts-api.brex.com/oauth2/default/v1/authorize?prompt=consent invalid_request: Duplicate parameter provided in request. Duplicated parameters: [prompt]
Microsoft 365 hosted MCP server (Entra ID) https://login.microsoftonline.com/.../authorize?prompt=select_account AADSTS9000411: The parameter 'prompt' is duplicated

Both requests ask for offline_access, so the SDK appends prompt=consent on top of the advertised value.

Fix

#1958 (open since 2026-04-24, CI green, not yet reviewed) changes append to set inside the offline_access branch. It targets main. Could it be reviewed, and backported to v1.x, which is still latest on npm? We apply exactly that change as a local patch on 1.32.1 today, and Brex then connects.

Note on Entra: set replaces select_account with consent, so the account picker no longer shows. Sending both values space-separated (select_account consent) is not an option, since Entra rejects that with AADSTS90023.

Reproduction

Any authorization server whose metadata advertises an authorization_endpoint with ?prompt=<anything>, a client that requests offline_access, then auth(): the authorization URL passed to redirectToAuthorization contains prompt=<anything>&...&prompt=consent.

Langage dominant
TypeScript
Étoiles
13.8k
Forks
2.5k
Merge moyen
6 j 23 h
PR mergées (30 j)
2

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de modelcontextprotocol/typescript-sdk

Toutes les issues de modelcontextprotocol/typescript-sdk

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.