depend on stable vscode.dev for auth extensions

This commit is contained in:
Tyler Leonhardt 2022-03-21 09:35:34 -07:00
parent 14ad945c42
commit 39c6779828
No known key found for this signature in database
GPG key ID: 1BC2B6244363E77E
2 changed files with 9 additions and 5 deletions

View file

@ -17,10 +17,12 @@ const localize = nls.loadMessageBundle();
const CLIENT_ID = '01ab8ac9400c4e429b23';
const GITHUB_AUTHORIZE_URL = 'https://github.com/login/oauth/authorize';
// TODO: change to stable when that happens
const GITHUB_TOKEN_URL = 'https://insiders.vscode.dev/codeExchangeProxyEndpoints/github/login/oauth/access_token';
const REDIRECT_URL = 'https://insiders.vscode.dev/redirect';
const GITHUB_TOKEN_URL = 'https://vscode.dev/codeExchangeProxyEndpoints/github/login/oauth/access_token';
const NETWORK_ERROR = 'network error';
const REDIRECT_URL_STABLE = 'https://vscode.dev/redirect';
const REDIRECT_URL_INSIDERS = 'https://insiders.vscode.dev/redirect';
class UriEventHandler extends vscode.EventEmitter<vscode.Uri> implements vscode.UriHandler {
constructor(private readonly Logger: Log) {
super();
@ -163,9 +165,12 @@ export class GitHubServer implements IGitHubServer {
const existingNonces = this._pendingNonces.get(scopes) || [];
this._pendingNonces.set(scopes, [...existingNonces, nonce]);
const proxyEndpoints: { [providerId: string]: string } | undefined = await vscode.commands.executeCommand('workbench.getCodeExchangeProxyEndpoints');
// If we are running in insiders vscode.dev, then ensure we use the redirect route on that.
const redirectUri = proxyEndpoints?.github?.includes('https://insiders.vscode.dev') ? REDIRECT_URL_INSIDERS : REDIRECT_URL_STABLE;
const searchParams = new URLSearchParams([
['client_id', CLIENT_ID],
['redirect_uri', REDIRECT_URL],
['redirect_uri', redirectUri],
['scope', scopes],
['state', encodeURIComponent(callbackUri.toString(true))]
]);

View file

@ -20,8 +20,7 @@ import path = require('path');
const localize = nls.loadMessageBundle();
// TODO: Change to stable when it's deployed.
const redirectUrl = 'https://insiders.vscode.dev/redirect';
const redirectUrl = 'https://vscode.dev/redirect';
const loginEndpointUrl = 'https://login.microsoftonline.com/';
const DEFAULT_CLIENT_ID = 'aebc6443-996d-45c2-90f0-388ff96faa56';
const DEFAULT_TENANT = 'organizations';