Skip to content

Commit f42a1b7

Browse files
authored
Merge pull request #316300 from microsoft/fix/tunnels-microsoft-auth-stuck
fix: tunnels getting stuck on Microsoft auth when not supported end-to-end
2 parents d3c0126 + a73c604 commit f42a1b7

1 file changed

Lines changed: 11 additions & 38 deletions

File tree

src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.ts

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -797,10 +797,6 @@ interface ITunnelPickItem extends IQuickPickItem {
797797
readonly tunnel: ITunnelInfo;
798798
}
799799

800-
interface IAuthProviderPickItem extends IQuickPickItem {
801-
readonly provider: 'github' | 'microsoft';
802-
}
803-
804800
async function promptToConnectViaTunnel(
805801
accessor: ServicesAccessor,
806802
options: { showBackButton?: boolean } = {},
@@ -813,42 +809,19 @@ async function promptToConnectViaTunnel(
813809
const productService = accessor.get(IProductService);
814810

815811
// Step 1: Determine auth provider — try cached sessions first, then prompt
816-
let authProvider = await tunnelService.getAuthProvider({ silent: true });
817-
818-
if (!authProvider) {
819-
// No cached session — prompt user to choose auth provider
820-
const authPicks: IAuthProviderPickItem[] = [
821-
{
822-
provider: 'github',
823-
label: localize('tunnelAuthGitHub', "GitHub"),
824-
description: localize('tunnelAuthGitHubDesc', "Sign in with your GitHub account"),
825-
},
826-
{
827-
provider: 'microsoft',
828-
label: localize('tunnelAuthMicrosoft', "Microsoft Account"),
829-
description: localize('tunnelAuthMicrosoftDesc', "Sign in with your Microsoft account"),
830-
},
831-
];
832-
833-
const authPicked = await quickInputService.pick(authPicks, {
834-
title: localize('tunnelAuthTitle', "Sign In for Dev Tunnels"),
835-
placeHolder: localize('tunnelAuthPlaceholder', "Choose an authentication provider"),
836-
});
837-
if (!authPicked) {
838-
return;
839-
}
840-
authProvider = authPicked.provider;
812+
// This used to call tunnelService.getAuthProvider, but for now we're Github-
813+
// only for the remote AH connection.
814+
const authProvider = 'github';
841815

842-
// Trigger interactive auth for the chosen provider
843-
const scopes = productService.tunnelApplicationConfig?.authenticationProviders?.[authProvider]?.scopes ?? [];
844-
try {
845-
if (!(await authenticationService.getSessions(authProvider, scopes)).length) {
846-
await authenticationService.createSession(authProvider, scopes, { activateImmediate: true });
847-
}
848-
} catch {
849-
notificationService.error(localize('tunnelAuthFailed', "Authentication failed. Please try again."));
850-
return;
816+
// Trigger interactive auth for the chosen provider
817+
const scopes = productService.tunnelApplicationConfig?.authenticationProviders?.[authProvider]?.scopes ?? [];
818+
try {
819+
if (!(await authenticationService.getSessions(authProvider, scopes)).length) {
820+
await authenticationService.createSession(authProvider, scopes, { activateImmediate: true });
851821
}
822+
} catch {
823+
notificationService.error(localize('tunnelAuthFailed', "Authentication failed. Please try again."));
824+
return;
852825
}
853826

854827
// Step 2: Show tunnel picker immediately in busy state while enumerating

0 commit comments

Comments
 (0)