AzureAD / microsoft-authentication-library-for-dotnet

Microsoft Authentication Library (MSAL) for .NET
https://aka.ms/msal-net
MIT License
1.39k stars 340 forks source link

[Bug] : Not able to log-in after 1 hour of inactivity #3734

Closed Yash130Cerner closed 1 year ago

Yash130Cerner commented 2 years ago

Logs and network traces

Which version of MSAL.NET are you using? 2.18.4

Platform .Net framework - 4.7.2

What authentication flow has the issue?

Other? We have implemented AAD login in our web application using MSAL library.

For some of users, we are getting error, when portal is open for more than 1 hour, it is getting redirected to login

Is this a new or existing app?

Repro

var your = (code) => here;

Expected behavior User should be able to re-login without any issue

Actual behavior MicrosoftTeams-image

User is facing an error of couldn't login, please find attached snapshot for the reference.

Possible solution Not sure

Additional context / logs / screenshots / links to code

Add any other context about the problem here, such as logs and screenshots, and even links to code.

bgavrilMS commented 2 years ago

We would need more information for this - is this a web site or a desktop app? Does this always happen or just for some user? Can you upgrade to the latest MSAL and provide logs?

yogi409 commented 2 years ago

log traces.txt Hey, It is web site. It happens to some users. We upgraded MSAL packages (Microsoft.Identity.Client.Extention.Msal) to stable 2.24 version, if you can help us to know which all packages need to update with MSAL package?

bgavrilMS commented 2 years ago

Microsoft.Identity.Client.Extention.Msal has some functionality related to desktop applications. Websites do not need this. For web site, are you using ASP.NET Core? Did you see https://learn.microsoft.com/en-us/azure/active-directory/develop/sample-v2-code#web-applications - there are sample apps that show you how to integrate.

yogi409 commented 2 years ago

We are using ASP.Net framework - 4.7.2 version.

bgavrilMS commented 2 years ago

Got it - have a look at this sample that shows how to integrate MSAL into an ASP.NET site. In particular, AcquireTokenSilent will fetch a new access token after the initial one expires.

https://github.com/Azure-Samples/ms-identity-aspnet-webapp-openidconnect