Onboard GitHub & Microsoft auth extensions to l10n (#163662)

* onboard github-auth completely to l10n

* onboard microsoft-authentication entirely on to l10n
This commit is contained in:
Tyler James Leonhardt
2022-10-14 08:41:21 -07:00
committed by GitHub
parent f83ad50c89
commit 6684350a58
8 changed files with 39 additions and 45 deletions

View File

@@ -7,7 +7,6 @@ import * as randomBytes from 'randombytes';
import * as querystring from 'querystring';
import { Buffer } from 'buffer';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { v4 as uuid } from 'uuid';
import fetch, { Response } from 'node-fetch';
import Logger from './logger';
@@ -17,8 +16,6 @@ import { BetterTokenStorage, IDidChangeInOtherWindowEvent } from './betterSecret
import { LoopbackAuthServer } from './authServer';
import path = require('path');
const localize = nls.loadMessageBundle();
const redirectUrl = 'https://vscode.dev/redirect';
const loginEndpointUrl = 'https://login.microsoftonline.com/';
const DEFAULT_CLIENT_ID = 'aebc6443-996d-45c2-90f0-388ff96faa56';
@@ -139,7 +136,7 @@ export class AzureActiveDirectoryService {
sessionId: session.id
});
} else {
vscode.window.showErrorMessage(localize('signOut', "You have been signed out because reading stored authentication information failed."));
vscode.window.showErrorMessage(vscode.l10n.t('You have been signed out because reading stored authentication information failed.'));
Logger.error(e);
await this.removeSessionByIToken({
accessToken: undefined,
@@ -446,7 +443,7 @@ export class AzureActiveDirectoryService {
onDidChangeSessions.fire({ added: [], removed: [], changed: [this.convertToSessionSync(refreshedToken)] });
} catch (e) {
if (e.message !== REFRESH_NETWORK_FAILURE) {
vscode.window.showErrorMessage(localize('signOut', "You have been signed out because reading stored authentication information failed."));
vscode.window.showErrorMessage(vscode.l10n.t('You have been signed out because reading stored authentication information failed.'));
await this.removeSessionById(sessionId);
}
}
@@ -683,9 +680,9 @@ export class AzureActiveDirectoryService {
private async handleCodeInputBox(inputBox: vscode.InputBox, verifier: string, scopeData: IScopeData): Promise<vscode.AuthenticationSession> {
inputBox.ignoreFocusOut = true;
inputBox.title = localize('pasteCodeTitle', 'Microsoft Authentication');
inputBox.prompt = localize('pasteCodePrompt', 'Provide the authorization code to complete the sign in flow.');
inputBox.placeholder = localize('pasteCodePlaceholder', 'Paste authorization code here...');
inputBox.title = vscode.l10n.t('Microsoft Authentication');
inputBox.prompt = vscode.l10n.t('Provide the authorization code to complete the sign in flow.');
inputBox.placeholder = vscode.l10n.t('Paste authorization code here...');
return new Promise((resolve: (value: vscode.AuthenticationSession) => void, reject) => {
inputBox.show();
inputBox.onDidAccept(async () => {
@@ -829,7 +826,7 @@ export class AzureActiveDirectoryService {
} catch (e) {
// Network failures will automatically retry on next poll.
if (e.message !== REFRESH_NETWORK_FAILURE) {
vscode.window.showErrorMessage(localize('signOut', "You have been signed out because reading stored authentication information failed."));
vscode.window.showErrorMessage(vscode.l10n.t('You have been signed out because reading stored authentication information failed.'));
await this.removeSessionById(session.id);
}
return;