Skip to content

Commit 3375b2a

Browse files
bpaseroRachel Macfarlane
authored andcommitted
api - adopt vscode.env.asExternalUri
1 parent cb5db0c commit 3375b2a

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/authentication/githubServer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import { PromiseAdapter, promiseFromEvent } from '../common/utils';
77
import { HostHelper, IHostConfiguration } from './configuration';
88
import { listHosts, onDidChange as onKeychainDidChange, toCanonical } from './keychain';
99
import uuid = require('uuid');
10+
import { EXTENSION_ID } from '../constants';
1011

1112
const SCOPES: string = 'read:user user:email repo write:discussion';
12-
const GHE_OPTIONAL_SCOPES: { [key: string]: boolean } = {'write:discussion': true};
13+
const GHE_OPTIONAL_SCOPES: { [key: string]: boolean } = { 'write:discussion': true };
1314

1415
const AUTH_RELAY_SERVER = 'vscode-auth.github.com';
1516

@@ -183,7 +184,7 @@ export class GitHubServer {
183184

184185
public async login(): Promise<IHostConfiguration> {
185186
const state = uuid();
186-
const callbackUri = await vscode.env.createAppUri({ payload: { path: '/did-authenticate' } });
187+
const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://${EXTENSION_ID}/did-authenticate`));
187188
const host = this.hostUri.toString();
188189
const uri = vscode.Uri.parse(`https://${AUTH_RELAY_SERVER}/authorize/?callbackUri=${encodeURIComponent(callbackUri.toString())}&scope=${SCOPES}&state=${state}&responseType=code&authServer=${host}`);
189190

src/typings/vscode.proposed.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,8 @@ declare module 'vscode' {
825825
* ```
826826
*/
827827
export function createAppUri(options?: AppUriOptions): Thenable<Uri>;
828+
829+
export function asExternalUri(target: Uri): Thenable<Uri>;
828830
}
829831

830832
//#endregion

0 commit comments

Comments
 (0)