diff --git a/1-Call-MSGraph/daemon-console/ProtectedApiCallHelper.cs b/1-Call-MSGraph/daemon-console/ProtectedApiCallHelper.cs index ca71263..6ca7d6f 100644 --- a/1-Call-MSGraph/daemon-console/ProtectedApiCallHelper.cs +++ b/1-Call-MSGraph/daemon-console/ProtectedApiCallHelper.cs @@ -59,12 +59,12 @@ public async Task CallWebApiAndProcessResultASync(string webApiUrl, string acces { if (!string.IsNullOrEmpty(accessToken)) { - var defaultRequetHeaders = HttpClient.DefaultRequestHeaders; - if (defaultRequetHeaders.Accept == null || !defaultRequetHeaders.Accept.Any(m => m.MediaType == "application/json")) + var defaultRequestHeaders = HttpClient.DefaultRequestHeaders; + if (defaultRequestHeaders.Accept == null || !defaultRequestHeaders.Accept.Any(m => m.MediaType == "application/json")) { HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); } - defaultRequetHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken); + defaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken); HttpResponseMessage response = await HttpClient.GetAsync(webApiUrl); if (response.IsSuccessStatusCode) diff --git a/2-Call-OwnApi/README.md b/2-Call-OwnApi/README.md index ce8f681..291a7be 100644 --- a/2-Call-OwnApi/README.md +++ b/2-Call-OwnApi/README.md @@ -253,14 +253,14 @@ The relevant code for this sample is in the `Program.cs` file, in the `RunAsync( In this sample, we are calling "https://localhost:44372/api/todolist" with the access token as a bearer token. ```CSharp - var defaultRequetHeaders = HttpClient.DefaultRequestHeaders; + var defaultRequestHeaders = HttpClient.DefaultRequestHeaders; - if (defaultRequetHeaders.Accept == null || !defaultRequetHeaders.Accept.Any(m => m.MediaType == "application/json")) + if (defaultRequestHeaders.Accept == null || !defaultRequestHeaders.Accept.Any(m => m.MediaType == "application/json")) { HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); } - defaultRequetHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken); + defaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken); ``` ### TodoList Web API Code diff --git a/2-Call-OwnApi/daemon-console/ProtectedApiCallHelper.cs b/2-Call-OwnApi/daemon-console/ProtectedApiCallHelper.cs index ce60876..4d46513 100644 --- a/2-Call-OwnApi/daemon-console/ProtectedApiCallHelper.cs +++ b/2-Call-OwnApi/daemon-console/ProtectedApiCallHelper.cs @@ -60,12 +60,12 @@ public async Task CallWebApiAndProcessResultASync(string webApiUrl, string acces { if (!string.IsNullOrEmpty(accessToken)) { - var defaultRequetHeaders = HttpClient.DefaultRequestHeaders; - if (defaultRequetHeaders.Accept == null || !defaultRequetHeaders.Accept.Any(m => m.MediaType == "application/json")) + var defaultRequestHeaders = HttpClient.DefaultRequestHeaders; + if (defaultRequestHeaders.Accept == null || !defaultRequestHeaders.Accept.Any(m => m.MediaType == "application/json")) { HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); } - defaultRequetHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken); + defaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken); HttpResponseMessage response = await HttpClient.GetAsync(webApiUrl); if (response.IsSuccessStatusCode)