From 7238e4373d668e29c9743341c427b1db5166abd5 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Thu, 23 Jan 2020 11:22:21 -0500 Subject: [PATCH] Updated lamda function to remove async label and return Task --- Demos/02-add-aad-auth/graph-tutorial/Helpers/GraphHelper.cs | 3 ++- Demos/03-add-msgraph/graph-tutorial/Helpers/GraphHelper.cs | 5 +++-- tutorial/04-add-aad-auth.md | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Demos/02-add-aad-auth/graph-tutorial/Helpers/GraphHelper.cs b/Demos/02-add-aad-auth/graph-tutorial/Helpers/GraphHelper.cs index 2e5d875..59a8268 100644 --- a/Demos/02-add-aad-auth/graph-tutorial/Helpers/GraphHelper.cs +++ b/Demos/02-add-aad-auth/graph-tutorial/Helpers/GraphHelper.cs @@ -13,10 +13,11 @@ public static async Task GetUserDetailsAsync(string accessToken) { var graphClient = new GraphServiceClient( new DelegateAuthenticationProvider( - async (requestMessage) => + (requestMessage) => { requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); + return Task.FromResult(0); })); return await graphClient.Me.Request().GetAsync(); diff --git a/Demos/03-add-msgraph/graph-tutorial/Helpers/GraphHelper.cs b/Demos/03-add-msgraph/graph-tutorial/Helpers/GraphHelper.cs index dd47598..cd82c1b 100644 --- a/Demos/03-add-msgraph/graph-tutorial/Helpers/GraphHelper.cs +++ b/Demos/03-add-msgraph/graph-tutorial/Helpers/GraphHelper.cs @@ -26,10 +26,11 @@ public static async Task GetUserDetailsAsync(string accessToken) { var graphClient = new GraphServiceClient( new DelegateAuthenticationProvider( - async (requestMessage) => + (requestMessage) => { requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); + return Task.FromResult(0); })); return await graphClient.Me.Request().GetAsync(); @@ -58,7 +59,7 @@ private static GraphServiceClient GetAuthenticatedClient() .WithClientSecret(appSecret) .Build(); - var tokenStore = new SessionTokenStore(idClient.UserTokenCache, + var tokenStore = new SessionTokenStore(idClient.UserTokenCache, HttpContext.Current, ClaimsPrincipal.Current); var accounts = await idClient.GetAccountsAsync(); diff --git a/tutorial/04-add-aad-auth.md b/tutorial/04-add-aad-auth.md index b9b94e8..3d7ad42 100644 --- a/tutorial/04-add-aad-auth.md +++ b/tutorial/04-add-aad-auth.md @@ -239,10 +239,11 @@ Once the user is logged in, you can get their information from Microsoft Graph. { var graphClient = new GraphServiceClient( new DelegateAuthenticationProvider( - async (requestMessage) => + (requestMessage) => { requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); + return Task.FromResult(0); })); return await graphClient.Me.Request().GetAsync();