mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
gh auth: fix staging server selection
This commit is contained in:
@@ -54,7 +54,11 @@ export class GitHubServer {
|
||||
this.updateStatusBarItem(true);
|
||||
|
||||
const state = uuid();
|
||||
const callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate`));
|
||||
let callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate`));
|
||||
|
||||
// TODO@joaomoreno TODO@RMacfarlane
|
||||
const staging = callbackUri.scheme === 'https' && /^vscode\./.test(callbackUri.authority);
|
||||
callbackUri = await vscode.env.asExternalUri(vscode.Uri.parse(`${vscode.env.uriScheme}://vscode.github-authentication/did-authenticate${staging ? '?staging=true' : ''}`));
|
||||
|
||||
if (this.isTestEnvironment(callbackUri)) {
|
||||
const token = await vscode.window.showInputBox({ prompt: 'GitHub Personal Access Token', ignoreFocusOut: true });
|
||||
@@ -81,8 +85,6 @@ export class GitHubServer {
|
||||
const existingStates = this._pendingStates.get(scopes) || [];
|
||||
this._pendingStates.set(scopes, [...existingStates, state]);
|
||||
|
||||
// TODO@joaomoreno TODO@RMacfarlane
|
||||
const staging = callbackUri.scheme === 'https' && /^vscode\./.test(callbackUri.authority);
|
||||
const uri = vscode.Uri.parse(`https://${staging ? AUTH_RELAY_STAGING_SERVER : AUTH_RELAY_SERVER}/authorize/?callbackUri=${encodeURIComponent(callbackUri.toString())}&scope=${scopes}&state=${state}&responseType=code&authServer=https://github.com${staging ? '&staging=true' : ''}`);
|
||||
await vscode.env.openExternal(uri);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user