Describe the feature or problem you'd like to solve
The GitHub CLI currently uses the token scheme for Authorization headers (Authorization: token <TOKEN>), while GitHub's official API documentation and examples consistently use the standard Bearer scheme (Authorization: Bearer <TOKEN>).
This creates three problems:
-
Blocks JWT/GitHub App authentication: GitHub's REST API documentation explicitly states: "if you are passing a JSON web token (JWT), you must use Authorization: Bearer". The current token scheme prevents proper GitHub App integration.
-
Blocks enterprise proxy/SSO integrations: Many enterprises use proxy patterns where SSO issues internal bearer tokens, a proxy exchanges them for GitHub tokens via GitHub App authentication, and forwards requests to GitHub's API. The token scheme forces enterprises to build custom workarounds, maintain CLI forks, or avoid the CLI entirely because GitHub Apps expect Bearer per OAuth 2.0 standards.
-
Diverges from GitHub's own standards: All official GitHub API curl examples use Bearer, and GitHub's own tools (Octokit, GitHub Actions) use Bearer as the standard. The CLI is inconsistent with the broader GitHub ecosystem.
Proposed solution
Change all Authorization headers from token scheme to Bearer scheme:
Current:
req.Header.Set(authorization, fmt.Sprintf("token %s", token))
Proposed:
req.Header.Set(authorization, fmt.Sprintf("Bearer %s", token))
Benefits:
- Enables JWT-based GitHub App authentication
- Removes barriers for enterprise proxy/SSO integrations
- Aligns with GitHub's documented API standards and examples
- Complies with RFC 6750 (OAuth 2.0 Bearer Token Usage)
- Matches GitHub's own tooling ecosystem (Octokit, Actions, etc.)
- Future-proofs the CLI as GitHub continues OAuth 2.0 standardization
Compatibility: According to GitHub's documentation, both schemes are currently accepted for personal access tokens, so this change is non-breaking for individual users while unlocking enterprise and GitHub App scenarios.
Files affected:
api/http_client.go
pkg/cmd/auth/shared/login_flow.go
pkg/cmd/auth/shared/oauth_scopes.go
- Associated test files
Additional context
This issue is related to closed PR #11667 by @nishithsoni, which was closed pending proper justification per contribution guidelines.
References:
Describe the feature or problem you'd like to solve
The GitHub CLI currently uses the
tokenscheme for Authorization headers (Authorization: token <TOKEN>), while GitHub's official API documentation and examples consistently use the standardBearerscheme (Authorization: Bearer <TOKEN>).This creates three problems:
Blocks JWT/GitHub App authentication: GitHub's REST API documentation explicitly states: "if you are passing a JSON web token (JWT), you must use Authorization: Bearer". The current
tokenscheme prevents proper GitHub App integration.Blocks enterprise proxy/SSO integrations: Many enterprises use proxy patterns where SSO issues internal bearer tokens, a proxy exchanges them for GitHub tokens via GitHub App authentication, and forwards requests to GitHub's API. The
tokenscheme forces enterprises to build custom workarounds, maintain CLI forks, or avoid the CLI entirely because GitHub Apps expectBearerper OAuth 2.0 standards.Diverges from GitHub's own standards: All official GitHub API curl examples use
Bearer, and GitHub's own tools (Octokit, GitHub Actions) useBeareras the standard. The CLI is inconsistent with the broader GitHub ecosystem.Proposed solution
Change all Authorization headers from
tokenscheme toBearerscheme:Current:
Proposed:
Benefits:
Compatibility: According to GitHub's documentation, both schemes are currently accepted for personal access tokens, so this change is non-breaking for individual users while unlocking enterprise and GitHub App scenarios.
Files affected:
api/http_client.gopkg/cmd/auth/shared/login_flow.gopkg/cmd/auth/shared/oauth_scopes.goAdditional context
This issue is related to closed PR #11667 by @nishithsoni, which was closed pending proper justification per contribution guidelines.
References: