mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Don't run the local server option if we are running in remote (#169076)
Additionally improve the conditional for device code flow. ref #168338
This commit is contained in:
parent
cd744cab40
commit
342a1f4f52
|
@ -68,8 +68,7 @@ export class GitHubAuthenticationProvider implements vscode.AuthenticationProvid
|
|||
this._logger,
|
||||
this._telemetryReporter,
|
||||
uriHandler,
|
||||
// We only can use the Device Code flow when we have a full node environment because of CORS.
|
||||
context.extension.extensionKind === vscode.ExtensionKind.Workspace || vscode.env.uiKind === vscode.UIKind.Desktop,
|
||||
context.extension.extensionKind,
|
||||
ghesUri);
|
||||
|
||||
// Contains the current state of the sessions we have available.
|
||||
|
|
|
@ -71,7 +71,7 @@ export class GitHubServer implements IGitHubServer {
|
|||
private readonly _logger: Log,
|
||||
private readonly _telemetryReporter: ExperimentationTelemetry,
|
||||
private readonly _uriHandler: UriEventHandler,
|
||||
private readonly _supportDeviceCodeFlow: boolean,
|
||||
private readonly _extensionKind: vscode.ExtensionKind,
|
||||
private readonly _ghesUri?: vscode.Uri
|
||||
) {
|
||||
this._type = _ghesUri ? AuthProviderType.githubEnterprise : AuthProviderType.github;
|
||||
|
@ -164,8 +164,13 @@ export class GitHubServer implements IGitHubServer {
|
|||
}
|
||||
}
|
||||
|
||||
// Starting a local server isn't supported in web
|
||||
if (vscode.env.uiKind === vscode.UIKind.Desktop) {
|
||||
// Starting a local server is only supported if:
|
||||
// 1. We are in a UI extension because we need to open a port on the machine that has the browser
|
||||
// 2. We are in a node runtime because we need to open a port on the machine
|
||||
if (
|
||||
this._extensionKind === vscode.ExtensionKind.UI &&
|
||||
typeof navigator === 'undefined'
|
||||
) {
|
||||
try {
|
||||
await promptToContinue();
|
||||
return await this.doLoginWithLocalServer(scopes);
|
||||
|
@ -175,7 +180,8 @@ export class GitHubServer implements IGitHubServer {
|
|||
}
|
||||
}
|
||||
|
||||
if (this._supportDeviceCodeFlow) {
|
||||
// We only can use the Device Code flow when we have a full node environment because of CORS.
|
||||
if (typeof navigator === 'undefined') {
|
||||
try {
|
||||
await promptToContinue();
|
||||
return await this.doLoginDeviceCodeFlow(scopes);
|
||||
|
|
Loading…
Reference in a new issue