Azure-Samples / ms-identity-aspnet-webapp-openidconnect

A sample showcasing how to develop a web application that handles sign on via the unified Azure AD and MSA endpoint, so that users can sign in using both their work/school account or Microsoft account. The sample also shows how to use MSAL to obtain a token for invoking the Microsoft Graph, as well as incrementental consent.
MIT License
171 stars 72 forks source link

Fixing #48 #52

Closed jmprieur closed 3 years ago

jmprieur commented 3 years ago

Fixes the problem await app.GetAccountAsync(ClaimsPrincipal.Current.GetAccountId()); always returns null,

What happened? The service provider was re-created each time we called BuildConfidentialClientApplication(), and therefore there were as many InMemoryCache as apps created, whereas the InMemoryCache should be one service for the application

This PR makes sure the service provider is a singleton. I also updated https://github.com/AzureAD/microsoft-identity-web/wiki/asp-net

henrik-me commented 3 years ago

utest?