[Bug] PlatformNotSupportedException in AcquireTokenInteractive call
See original GitHub issueWhich Version of MSAL are you using ? Note that to get help, you need to run the latest version. Preview version are also ok. For ADAL, please log issues to https://github.com/AzureAD/azure-activedirectory-library-for-dotnet
4.16.0 Platform
netstandard2.0 What authentication flow has the issue?
- Desktop / Mobile
- Interactive
- Integrated Windows Auth
- Username Password
- Device code flow (browserless)
- Web App
- Authorization code
- OBO
- Web API
- OBO
Other? - please describe;
Is this a new or existing app?
This is a new app or experiment Repro
authResult = await app.AcquireTokenInteractive(scopes)
.ExecuteAsync().ConfigureAwait(false);
Expected behavior
A clear and concise description of what you expected to happen (or code).
Interactive UI pop-up should show up for sign-in.
Actual behavior
A clear and concise description of what happens, e.g. exception is thrown, UI freezes
Following exception is thrown:
System.PlatformNotSupportedException
HResult=0x80131539
Message=Possible Cause: If you are using an XForms app, or generally a netstandard assembly, make sure you add a reference to Microsoft.Identity.Client.dll from each platform assembly (e.g. UWP, Android, iOS), not just from the common netstandard assembly
Source=Microsoft.Identity.Client
StackTrace:
at Microsoft.Identity.Client.Platforms.netstandard13.WebUIFactory.CreateAuthenticationDialog(CoreUIParent parent, RequestContext requestContext)
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.CreateWebAuthenticationDialog()
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.<FetchAuthCodeAndPkceVerifierAsync>d__4.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.<GetTokenResponseAsync>d__11.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.<ExecuteAsync>d__8.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.<RunAsync>d__14.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Identity.Client.ApiConfig.Executors.PublicClientExecutor.<ExecuteAsync>d__2.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Microsoft.DevCanvas.Common.Providers.AuthZMsalProvider.<GetInteractiveFlowToken>d__2.MoveNext() in D:\devcanvas\Analyzers\Analyzers\Extensions\AuthZMsalProvider.cs:line 41
This exception was originally thrown at this call stack: [External Code] Microsoft.DevCanvas.Common.Providers.AuthZMsalProvider.GetInteractiveFlowToken() in AuthZMsalProvider.cs
Possible Solution
Additional context/ Logs / Screenshots Add any other context about the problem here, such as logs and screebshots. Logging is described at https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/logging
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (9 by maintainers)
Top GitHub Comments
Hi @ShaneOss - for mobile plantforms and UWP, MSAL takes care of the token cache for you:
On other runtimes, we ask developers to define where the cache is stored etc.
https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-net-token-cache-serialization?tabs=mobile
I do not recommed it, it will not be easy to implement. Let’s continue the discussion on Discussions tab.