I am using this chunk of code to get the access token. code is working fine on IIS Express but when I host web app in to IIS then code hangs and went in to infinite loop.
authResult = await app.AcquireTokenInteractive(scopes).WithUseEmbeddedWebView(true)
.ExecuteAsync();
I also opened the firewall ports on windows.