diff --git a/MicrosoftTranslatorProvider/Service/MicrosoftService.cs b/MicrosoftTranslatorProvider/Service/MicrosoftService.cs index cc964257c..5514f46f4 100644 --- a/MicrosoftTranslatorProvider/Service/MicrosoftService.cs +++ b/MicrosoftTranslatorProvider/Service/MicrosoftService.cs @@ -39,7 +39,6 @@ public static async Task AuthenticateUser(MicrosoftCredentials credentials var response = await httpClient.SendAsync(request); response.EnsureSuccessStatusCode(); var tokenString = await response.Content.ReadAsStringAsync(); - var token = ReadToken(tokenString); credentials.AccessToken = "Bearer " + tokenString; return true; } @@ -50,7 +49,7 @@ public static async Task AuthenticateUser(MicrosoftCredentials credentials } } - public async static Task> GetSupportedLanguages() + public static async Task> GetSupportedLanguages() { var httpClientHandler = ProxyHelper.GetHttpClientHandler(CredentialsManager.GetProxySettings(), true); var httpClient = new HttpClient(httpClientHandler); @@ -70,21 +69,13 @@ public async static Task> GetSupportedLanguages() return output; } - public async static Task> GetSupportedLanguageCodes() + public static async Task> GetSupportedLanguageCodes() { var supportedLanguages = await GetSupportedLanguages(); var supportedCodes = new HashSet(supportedLanguages.Select(x => x.LanguageCode)); return supportedCodes; } - private static JwtSecurityToken ReadToken(string token) - { - var jwtHandler = new JwtSecurityTokenHandler(); - var readableToken = jwtHandler.CanReadToken(token); - return readableToken ? jwtHandler.ReadJwtToken(token) - : null; - } - public static async Task TranslateAsync(PairModel pairModel, string textToTranslate, MicrosoftCredentials microsoftCredentials) { var sourceLanguage = pairModel.SourceLanguageCode;