github / github/copilot-cli

Copilot CLI OAuth login fails — CLI doesn't bind to port declared in its own CIMD client-metadata.json

オープン
#4,800 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

triage
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

Describe the bug

When authenticating to an MCP server that uses CIMD (Client ID Metadata Document) OAuth, Copilot CLI fails with:

{"error":"invalid_request","error_description":"Redirect URI 'http://127.0.0.1:<random_port>/' does not match CIMD redirect_uris.","state":"..."}

Root cause: Copilot CLI's own published client metadata ( https://github.com/copilot/cli/client-metadata.json ) declares a single fixed redirect URI:

"redirect_uris": ["http://127.0.0.1:33418/"]

Per the CIMD/OAuth spec, the redirect_uri used in the  /authorize  request must exactly match this declared value (RFC 8252's "any loopback port" leniency only applies when no port is specified — here one is).

However, Copilot CLI does not bind its local OAuth callback listener to port 33418 — it uses a different, seemingly random port instead (observed: 63450, then 61566), even when port 33418 is confirmed free/unused on the machine. This causes every login attempt against CIMD-based OAuth servers to fail.

Affected version

Copilot CLI v1.0.83, Windows

Steps to reproduce the behavior
  1. Confirm port 33418 is free ( Get-NetTCPConnection -LocalPort 33418  returns nothing).
  2. Attempt login to an MCP server using CIMD OAuth (client_id = a metadata document URL).
  3. Copilot CLI opens a callback listener on a different port than 33418.
  4. Server rejects with  invalid_request  / redirect_uri mismatch.
Expected behavior

Copilot CLI should bind its OAuth loopback listener to the exact port(s) declared in its own  client-metadata.json  (33418), consistent with CIMD requirements.

Additional context

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、/authorize リクエストからローカルのループバックコールバックリスナーまで OAuth フローを追跡し、次に、選択されたポートと、公開されている client-metadata.json の redirect_uris 値を比較します。ポート 33418 を空け、CIMD MCP サーバーを使って再現します。完了の条件は、リスナーとリクエストが宣言された URI を使用し、ログインで invalid_request が返されなくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
shell
領域
authentication, cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
64/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。