fix: Allow Github.com auth when github-enterprise.uri is set#7002
Merged
alexr00 merged 3 commits intomicrosoft:mainfrom Jun 23, 2025
Merged
fix: Allow Github.com auth when github-enterprise.uri is set#7002alexr00 merged 3 commits intomicrosoft:mainfrom
github-enterprise.uri is set#7002alexr00 merged 3 commits intomicrosoft:mainfrom
Conversation
Contributor
Author
|
@alexr00 could I get a review? :) |
alexr00
requested changes
Jun 20, 2025
Member
alexr00
left a comment
There was a problem hiding this comment.
Thanks for the PR! I understand the motivation, but I think we need one change.
src/github/credentials.ts
Outdated
| } | ||
|
|
||
| private async doCreate(options: vscode.AuthenticationGetSessionOptions, additionalScopes: boolean = false): Promise<AuthResult> { | ||
| const github = await this.initialize(AuthProvider.github, options, additionalScopes ? SCOPES_WITH_ADDITIONAL : undefined, additionalScopes); |
Member
There was a problem hiding this comment.
This will cause a badge to be shown on the Accounts menu, prompting for github.com auth, even when enterprise auth is successful. If enterprise auth has succeeded, the options should include silent.
Contributor
Author
There was a problem hiding this comment.
Thanks for the feedback!
What do you think of this approach?
const githubOptions = { ...options };
if (enterprise && !enterprise.canceled && this.isAuthenticated(AuthProvider.githubEnterprise)) {
githubOptions.silent = true;
}
const github = await this.initialize(AuthProvider.github, githubOptions, additionalScopes ? SCOPES_WITH_ADDITIONAL : undefined, additionalScopes);
Member
There was a problem hiding this comment.
I don't know that the isAuthenticated check is needed, but otherwise it looks good.
Tyriar
approved these changes
Jun 23, 2025
Member
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Since version
0.110.0, setting the following configuration:causes the GitHub.com authentication flow to be skipped entirely. This results in:
github.comGithub.comrepos breaking silentlyFor many developers (including myself), contributing to both
github.comand a company-hosted GitHub Enterprise is common.Even though the config can be set per workspace, it can be tedious to maintain across multiple repositories.
And, in practice, setting
github-enterprise.uriin user settings makes more sense. But this intentionally disablesgithub.comfunctionality with the current logic.What does change?
This PR updates
doCreateso that GitHub.com is initialized even though the enterprise URI is configured.This mirrors pre-
0.110.0behavior.Before
After