Add OAuth 2.1 PKCE authentication for stdio mode #1836
Draft
+482
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements interactive OAuth 2.1 with PKCE for stdio mode, allowing browser-based authentication without manual PAT creation. Falls back to PAT if OAuth not configured.
Why
stdio users currently must manually create and manage Personal Access Tokens. OAuth provides a better UX with interactive browser consent while maintaining security through PKCE (no client secret required for public clients).
What changed
internal/oauthpackage implementing OAuth 2.1 with PKCE S256--oauth-client-id,--oauth-client-secret,--oauth-scopes--gh-hostfor GHES/GHEC supportrepo,user,gist,notifications,read:org,projectMCP impact
Security / limits
golang.org/x/oauth2(no custom auth code)Tool renaming
Lint & tests
./script/lint./script/testDocs
Usage:
Flow:
--oauth-client-id(no PAT)stdio-only by design. Remote server continues using PATs.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
go.googlesource.com/update-job-proxy /update-job-proxy --64 -o ux_amd64/link -o 4065655/b332/_pkg_.a -trimpath stdio -p b/github-mcp-serrev-parse -lang=go1.16 /opt/hostedtoolcache/go/1.24.11/x64/pkg/tool/linux_amd64/vet -uns�� zp0b/qdh15NexuYWXrf2mzp0b /tmp/go-build2265561799/b136/vet.cfg x64/pkg/tool/linux_amd64/vet -c=4 -nolocalimports -importcfg x64/pkg/tool/linux_amd64/vet(dns block)/update-job-proxy /update-job-proxy -o br-1cd4237c9914 -j DROP e/vcs/eb6bc1bfa080591d5c70f29cb5--detach sed ub.com/.insteadOf 2_G3.pem /usr/share/ca-ce--shallow-file k 7d017ee21785da21rev-list -e e=false sed e/git-remote-htt--alternate-refs fflib %H %ct %D 798c1aaeb27a4ebc-t e/git-remote-httfilter(dns block)go.yaml.in/update-job-proxy /update-job-proxy --64 -o ux_amd64/link -o 4065655/b332/_pkg_.a -trimpath stdio -p b/github-mcp-serrev-parse -lang=go1.16 /opt/hostedtoolcache/go/1.24.11/x64/pkg/tool/linux_amd64/vet -uns�� zp0b/qdh15NexuYWXrf2mzp0b /tmp/go-build2265561799/b136/vet.cfg x64/pkg/tool/linux_amd64/vet -c=4 -nolocalimports -importcfg x64/pkg/tool/linux_amd64/vet(dns block)/update-job-proxy /update-job-proxy -o br-1cd4237c9914 -j DROP e/vcs/eb6bc1bfa080591d5c70f29cb5--detach sed ub.com/.insteadOf 2_G3.pem /usr/share/ca-ce--shallow-file k 7d017ee21785da21rev-list -e e=false sed e/git-remote-htt--alternate-refs fflib %H %ct %D 798c1aaeb27a4ebc-t e/git-remote-httfilter(dns block)gopkg.in/update-job-proxy /update-job-proxy --64 -o ux_amd64/link -o 4065655/b332/_pkg_.a -trimpath stdio -p b/github-mcp-serrev-parse -lang=go1.16 /opt/hostedtoolcache/go/1.24.11/x64/pkg/tool/linux_amd64/vet -uns�� zp0b/qdh15NexuYWXrf2mzp0b /tmp/go-build2265561799/b136/vet.cfg x64/pkg/tool/linux_amd64/vet -c=4 -nolocalimports -importcfg x64/pkg/tool/linux_amd64/vet(dns block)/update-job-proxy /update-job-proxy -o br-1cd4237c9914 -j DROP e/vcs/eb6bc1bfa080591d5c70f29cb5--detach sed ub.com/.insteadOf 2_G3.pem /usr/share/ca-ce--shallow-file k 7d017ee21785da21rev-list -e e=false sed e/git-remote-htt--alternate-refs fflib %H %ct %D 798c1aaeb27a4ebc-t e/git-remote-httfilter(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.