@@ -364,7 +364,7 @@ export async function checkScopes(accessToken: string): Promise<string[]> {
364
364
* Creates a URL to be opened for the whole OAuth2 flow to kick-off
365
365
* @returns a `URL` string containing the whole auth URL
366
366
*/
367
- async function createOauth2URL ( context : vscode . ExtensionContext , options : { authorizationURI : string , clientID : string , redirectURI : vscode . Uri , scopes : string [ ] } ) : Promise < vscode . Uri > {
367
+ async function createOauth2URL ( context : vscode . ExtensionContext , options : { authorizationURI : string , clientID : string , redirectURI : vscode . Uri , scopes : string [ ] } ) : Promise < string > {
368
368
const { authorizationURI, clientID, redirectURI, scopes } = options ;
369
369
const { codeChallenge, codeVerifier } : { codeChallenge : string , codeVerifier : string } = create ( ) ;
370
370
@@ -379,14 +379,14 @@ async function createOauth2URL(context: vscode.ExtensionContext, options: { auth
379
379
}
380
380
381
381
set ( 'client_id' , clientID ) ;
382
- set ( 'redirect_uri' , redirectURI . toString ( ) ) ;
382
+ set ( 'redirect_uri' , ( redirectURI . toString ( true ) ) ) ;
383
383
set ( 'response_type' , 'code' ) ;
384
384
set ( 'scope' , scopes . join ( ' ' ) ) ;
385
385
set ( 'code_challenge' , codeChallenge ) ;
386
386
set ( 'code_challenge_method' , 'S256' ) ;
387
387
388
388
await context . secrets . store ( 'gitpod.code_verifier' , codeVerifier ) ;
389
- return vscode . Uri . parse ( authorizationURI ) . with ( { query } ) ;
389
+ return ` ${ authorizationURI } ? ${ query } ` ;
390
390
}
391
391
392
392
/**
@@ -411,7 +411,6 @@ async function askToEnable(context: vscode.ExtensionContext): Promise<void> {
411
411
*/
412
412
export async function createSession ( scopes : readonly string [ ] , context : vscode . ExtensionContext ) : Promise < vscode . AuthenticationSession > {
413
413
const callbackUri = await vscode . env . asExternalUri ( vscode . Uri . parse ( `${ vscode . env . uriScheme } ://gitpod.gitpod-desktop/complete-gitpod-auth` ) ) ;
414
-
415
414
if ( ! [ ...gitpodScopes ] . every ( ( scope ) => scopes . includes ( scope ) ) ) {
416
415
vscode . window . showErrorMessage ( 'The provided scopes are not enough to turn on Settings Sync' ) ;
417
416
}
@@ -430,12 +429,12 @@ export async function createSession(scopes: readonly string[], context: vscode.E
430
429
reject ( 'Login timed out.' ) ;
431
430
} , 1000 * 60 * 5 ) ; // 5 minutes
432
431
} ) ;
433
-
434
- const opened = await vscode . env . openExternal ( gitpodAuth ) ;
432
+ console . log ( gitpodAuth ) ;
433
+ const opened = await vscode . env . openExternal ( gitpodAuth as any ) ;
435
434
if ( ! opened ) {
436
- const selected = await vscode . window . showErrorMessage ( `Couldn't open ${ gitpodAuth . toString ( true ) } automatically, please copy and paste it to your browser manually.` , 'Copy' , 'Cancel' ) ;
435
+ const selected = await vscode . window . showErrorMessage ( `Couldn't open ${ gitpodAuth } automatically, please copy and paste it to your browser manually.` , 'Copy' , 'Cancel' ) ;
437
436
if ( selected === 'Copy' ) {
438
- vscode . env . clipboard . writeText ( gitpodAuth . toString ( true ) ) ;
437
+ vscode . env . clipboard . writeText ( gitpodAuth ) ;
439
438
console . log ( 'Copied auth URL' ) ;
440
439
}
441
440
}
0 commit comments