@@ -275,11 +275,6 @@ export async function resolveConnectionSpec(serverName: string, uri?: vscode.Uri
275275 }
276276}
277277
278- interface ServerManagerAuthSession extends vscode . AuthenticationSession {
279- serverName : string ;
280- userName : string ;
281- }
282-
283278async function resolvePassword ( serverSpec , ignoreUnauthenticated = false ) : Promise < void > {
284279 if (
285280 // Connection isn't unauthenticated
@@ -292,27 +287,19 @@ async function resolvePassword(serverSpec, ignoreUnauthenticated = false): Promi
292287 // Handle Server Manager extension version < 3.8.0
293288 const account = serverManagerApi . getAccount ? serverManagerApi . getAccount ( serverSpec ) : undefined ;
294289
295- let session = < ServerManagerAuthSession > await vscode . authentication . getSession (
296- serverManager . AUTHENTICATION_PROVIDER ,
297- scopes ,
298- {
299- silent : true ,
300- account,
301- }
302- ) ;
290+ let session = await vscode . authentication . getSession ( serverManager . AUTHENTICATION_PROVIDER , scopes , {
291+ silent : true ,
292+ account,
293+ } ) ;
303294 if ( ! session ) {
304- session = < ServerManagerAuthSession > await vscode . authentication . getSession (
305- serverManager . AUTHENTICATION_PROVIDER ,
306- scopes ,
307- {
308- createIfNone : true ,
309- account,
310- }
311- ) ;
295+ session = await vscode . authentication . getSession ( serverManager . AUTHENTICATION_PROVIDER , scopes , {
296+ createIfNone : true ,
297+ account,
298+ } ) ;
312299 }
313300 if ( session ) {
314- // If original spec lacked username use the one obtained by the authprovider
315- serverSpec . username = serverSpec . username || session . userName ;
301+ // If original spec lacked username use the one obtained from the user by the authprovider (exact case)
302+ serverSpec . username = serverSpec . username || session . scopes [ 1 ] ;
316303 serverSpec . password = session . accessToken ;
317304 }
318305 }
0 commit comments