I am tring to get a device token in Azure-ad-joined Windows machine by WAM API, and the code works well. But when the code runs in a Windows Service App(https://docs.microsoft.com/en-us/dotnet/framework/windows-services/walkthrough-creating-a-windows-service-application-in-the-component-designer)
Windows.Security.Authentication.Web.Core.WebAuthenticationCoreManager.FindAccountProviderAsync throws error "a specified logon session does not exist. it may already have been terminated"
Source: Windows Questions