Repository navigation
feat: Add GH_AUTH_SCHEME environment variable for Bearer token support - #11726
nishithsoni wants to merge 1 commit into
Conversation
- Add support for GH_AUTH_SCHEME environment variable in AddAuthTokenHeader - Defaults to 'token' for backward compatibility - Set to 'Bearer' to use Bearer token authentication format - Add comprehensive tests for different auth schemes - Update environment variables documentation This allows users to customize the authentication scheme used in Authorization headers for all internal GitHub CLI API calls.
There was a problem hiding this comment.
Pull Request Overview
Add support for configurable authentication schemes in GitHub CLI by introducing the GH_AUTH_SCHEME environment variable, enabling Bearer token authentication for JWT-based auth requirements while maintaining backward compatibility.
- Introduces GH_AUTH_SCHEME environment variable to customize the authentication scheme used in Authorization headers
- Defaults to "token" scheme for backward compatibility, with support for "Bearer" and custom schemes
- Adds comprehensive test coverage for different authentication schemes
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| api/http_client.go | Implements the core logic to read GH_AUTH_SCHEME environment variable and apply custom auth scheme |
| api/http_client_test.go | Adds comprehensive test coverage for different auth schemes including default, Bearer, and custom schemes |
| pkg/cmd/root/help_topic.go | Updates environment variables documentation to describe the new GH_AUTH_SCHEME option |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Hi @nishithsoni, thanks again for your efforts and work to improve As I mentioned in your other PR in #11667 (comment), we do not accept major contributions without an issue that has been discussed by our core maintainer team and subsequently had the
help wanted
To move your request forward:Please open an issue in our repository describing the why behind your request including what problems you're running into with the current behavior. We haven't heard this request from other users, so we really need much more detail about the problems and why you believe this will fix it, before adding any new settings. After we have discussed the issue, and if we have labelled the issue as
help wanted
Reference: |
Summary
This allows users to customize the authentication scheme used in
Authorization headers for all internal GitHub CLI API calls.
Related to issue: https://github.com/githubcustomers/Uber/issues/69
Customer Support thread: https://support.github.com/ticket/personal/0/3739042
Customer Reliability Engineer stated they would
open a feature request that references your policy requirement.But I do not have the feature request link.They also mentioned that other customers have run into this issue before and have had to create a proxy for this specific auth issue. I would prefer not to do that if it is a common pitfall of the CLI and would rather solve the issue with a change upstream.
This is a backwards compatible change to support the current default (
Authorization: token) while adding support forAuthorization: Bearerscheme auth which is required for JWT auth with GitHub APIs as referenced in GitHub docs here: https://docs.github.com/en/rest/authentication/authenticating-to-the-rest-api?apiVersion=2022-11-28Test Plan