-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] MSAL Login does not work after upgrading to winappsdk 1.6 #4933
Comments
If i change my code to use WithDefaultREdirectUri and not with the browserredirect it works. But it would be nice to have the older code work again |
Any plan for this? This is a complete showstopper for existing applications. I can't believe this isn't urgent enough that your team hasn't even bothered to respond to this issue. |
@CameronVetter investigation is ongoing. We have a repro that we're lookin at the best way to address. |
@panta2705 - can you walk me through your repro steps, along with the snippet of code that you are using to authenticate? I am testing this as we speak with MAUI and .NET 9 and so far not running into the issue you are calling out. |
@cconner100 @CameronVetter can you also please provide the code snippets that you are using that are triggering this? From my testing it seems contained to B2C scenarios. |
I can confirm my scenario is a B2C application. Here are my packages:
and the code that triggers the error is (greatly simplified):
|
I am running this as a test: var app = PublicClientApplicationBuilder.Create("foobar")
.WithWindowsEmbeddedBrowserSupport()
.WithRedirectUri($"https://bgcopilot.b2clogin.com/oauth2/nativeclient")
.Build();
var t = await app.AcquireTokenInteractive(new string[]{ "user.read" })
.WithUseEmbeddedWebView(true)
.ExecuteAsync(); I do not see any errors and the web view correctly shows. This targets What version of Windows are you running? Can you also please upgrade to the latest MSAL? |
@localden Here is some simplified code snippets, I can try making a sample project with the issue if needed
Respective libs used that produce error
Respective libs used that are working
|
Thank you, folks - will be running a few more tests today to see if I can reproduce this reliably. |
We observe the same problem in our applications |
Is there any updates on this @localden? Our only fix so far is keeping .NET SDK as 1.2 and downgrading WebView2 to 1.0.864.35 which seems asenine. Edit: Did some more digging, as I could not remember former WebView2 version: |
Any updates @localden? I'm still seeing this problem and blocked from releasing on Windows. Were you able to repro this locally? It's been many months without any progress on this critical showstopper! What is the timeline for getting this fixed? |
We're still working on a repro for this. @CameronVetter @mibinoob @ancker1 - what would be most helpful at this time is if you have a "minimum reproducible project." It can be a simple app that shows the behavior reliably, that you can attach to the issue. There are clearly conflicting dependencies, but I am trying to pinpoint the exact conditions under which those cause issues. |
Hi @localden you can use my sample to reproduce the issue with the old WebView version referenced by ms-auth. It is just a fork of ms-identity-dotnetcore-maui samples, upgraded to net9 and updated all nuget packages to latest. Also added the csproj workaround to be able to build in windows because of this issue (described in more detail in my issue #5015 ). Please use the MauiAppBasic project, fill-in the appsettings.json with auth info. The app should be run on Windows platform as the issue is only relevant for Windows. Make sure that you select the Use Embedded checkbox in the app before you hit "Sign In". You should end-up with the error: To add, you can also look into this branch, which directly references the version the error mentions and the auth works now, but we are unable to use any WebView control in MAUI-Windows because it looks up for a newer version giving the following error. After successfully login with "Use Embedded" option the app goes to the UserView page which I have place a WebView control. |
Has anyone come up with a workaround for this? As of yesterday I now have two apps that are blocked due to this bug... |
The DLL structure has changed (though
There is probably a binary/API incompatibility between the older and newer version. |
@iulico-1 @ashok672 seems like the issue is indeed caused by what @unrateddi and @espenrl called out (older version of |
When a bugfix is planned to be released? |
@lukaszzielnica - will delegate this decision to @iulico-1 and @ashok672, as I am no longer in the security side of the house. |
+1 |
+2 |
same error here with MAUI Hybrid Blazor + .NET 9 + Windows target. Please prioriize |
I have raised an issue on MS Developer Community as I am also getting this problem since upgrading to .Net 9 and it includes an Example .Net 8 app that works and a .Net 9 one that does not. https://developercommunity.visualstudio.com/t/DotNet-9-PublicClientApplication-Microso/10841011 |
We will work on the fix this week. Will update when there is something to share. |
@unrateddi , we haven't been able to reproduce this issue, even with the sample repo you provided (.NET 9/WinAppSDK 1.6). Are you still encountering this problem with the latest versions of .net9/Microsoft.Identity.Client.Desktop packages? As mentioned here - https://www.nuget.org/packages/Microsoft.Identity.Client.Desktop#dependencies-body-tab, the required version of WebView2 is >= 1.0.864.35, so it should work for the newer versions of webview2 as well, we're unsure what might be causing this issue. Since 1.0.864.35 is an very older version of WebView2, we're working on upgrading it to a newer version, but we're not sure yet if that will resolve the issue. |
@DharshanBJ , yes this is still reproducible in my sample repo even with the latest packages. I just pushed a commit with all nugets updated. Please confirm you are trying to reproduce it on the correct branch as mentioned in my post. The branch name is repro-version-notfound. Repro should be pretty easy on MauiAppBasic project like fill in appsettings.json with auth info, build, run, click "Use Embedded" checkbox, click "Sign in" button and then the exception should be thrown mentioning that version 1.0.864.35 of the dll is not found. Also you might need to enable System.IO.FileNotFoundException in Exception Settings in Visual Studio to get proper exception insights. |
I have added a simple VS Solution containing a .Net8 and a .Net9 version of the same project. The .Net8 works but the .Net9 does not. if you try the .Net9 version you get this error : 'Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'. The system cannot find the file specified.' |
We also still have this issue, please fix it ASAP! We get this exception message when logging on: This is interestingly, because the Microsoft.Client.IdentityDesktop package states it needs Microsoft.Web.WebView2 >= 1.0.864.35, so it should work with Microsoft.Web.WebView2 version 1.0.2792.45 or higher The problem in both situations is the DLL reference: So please fix the direct reference to the dll! |
I confirm reported issues and comments. We're developing a project in MAUI Hybrid Blazor with "net9" with MSAL interactive auth and this bug forces us to target "net8" in the whole project. |
Hello @DharshanBJ , any updates on this? We are 3 months in .NET9 with having to decide if we want working ms-auth or webview in MAUI Windows. |
Thanks simon for sharing your sample, we are able to repro this issue using your sample app now. |
Library version used
.NET version
.net 8.300. Windows App SDK 1.6
Scenario
PublicClient - desktop app
Is this a new or an existing app?
None
Issue description and reproduction steps
When our app was targeting WinAppSDK 1.5 the login would bring up the Browser login dialog box and allow us to login. After upgrading to WinAppSDK 1.6 we get the following error message and no Browser will pop up
AuthoritySignIn https://ziidmsapp.b2clogin.com/tfp/ziidmsapp.onmicrosoft.com/B2C_1A_signup_signin
AuthorityRedirectUrl msal3e2fe1b7-910e-46d2-aa0b-b1da7755d458://auth
'ZiiDMSApp.exe' (CoreCLR: clrhost): Loaded 'E:\ZiiDMS-NextGen\Client\Desktop\ZiiDMSApp\ZiiDMSApp\bin\Debug\net8.0-windows10.0.22621\AppX\Uno.Core.Extensions.Logging.Singleton.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ZiiDMSApp.exe' (CoreCLR: clrhost): Loaded 'E:\ZiiDMS-NextGen\Client\Desktop\ZiiDMSApp\ZiiDMSApp\bin\Debug\net8.0-windows10.0.22621\AppX\CommonServiceLocator.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
PermissionsScreenName is null or empty SetPermissionControls will not be called
'ZiiDMSApp.exe' (CoreCLR: clrhost): Loaded 'E:\ZiiDMS-NextGen\Client\Desktop\ZiiDMSApp\ZiiDMSApp\bin\Debug\net8.0-windows10.0.22621\AppX\Microsoft.Identity.Client.Extensions.Msal.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ZiiDMSApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.IO.FileSystem.Watcher.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ZiiDMSApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.Collections.Specialized.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ZiiDMSApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\8.0.8\System.Security.Cryptography.ProtectedData.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Clearing user token cache accessor.
MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Total number of cache partitions found while getting refresh tokens: 0
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - c8b05dd3-8834-4c40-b8c6-4c2718affe93] Skipping Instance discovery for B2C authority because it is not supported.
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - c8b05dd3-8834-4c40-b8c6-4c2718affe93] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Found 0 cache accounts and 0 broker accounts
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Returning 0 accounts
MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Clearing user token cache accessor.
MSAL: Always False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] [Internal cache] Total number of cache partitions found while getting refresh tokens: 0
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 7cba51d7-3401-482e-adcc-44d1dcd6f61d] Skipping Instance discovery for B2C authority because it is not supported.
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 7cba51d7-3401-482e-adcc-44d1dcd6f61d] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Found 0 cache accounts and 0 broker accounts
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z] Returning 0 accounts
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] MSAL MSAL.NetCore with assembly version '4.63.0.0'. CorrelationId(a3957b6e-b482-44c7-8a4c-a7218dbcb4c2)
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] === AcquireTokenSilent Parameters ===
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] LoginHint provided: False
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] Account provided: False
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] ForceRefresh: False
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2]
=== Request Data ===
Authority Provided? - True
Scopes - https://XXXX/access_as_user
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] === Token Acquisition (SilentRequest) started:
Scopes: https://XXXXX/access_as_user
'ZiiDMSApp.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.8\System.Reflection.Metadata.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
MSAL: Error False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - a3957b6e-b482-44c7-8a4c-a7218dbcb4c2] Exception type: Microsoft.Identity.Client.MsalUiRequiredException
, ErrorCode: user_null
HTTP StatusCode 0
CorrelationId a3957b6e-b482-44c7-8a4c-a7218dbcb4c2
To see full exception details, enable PII Logging. See https://aka.ms/msal-net-logging
at Microsoft.Identity.Client.Internal.Requests.Silent.SilentRequest.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
Exception thrown: 'Microsoft.Identity.Client.MsalUiRequiredException' in System.Private.CoreLib.dll
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] MSAL MSAL.NetCore with assembly version '4.63.0.0'. CorrelationId(110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6)
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] === InteractiveParameters Data ===
LoginHint provided: False
User provided: False
UseEmbeddedWebView: NotSpecified
ExtraScopesToConsent:
Prompt: login
HasCustomWebUi: False
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6]
=== Request Data ===
Authority Provided? - True
Scopes - https:/XXXXXXX/access_as_user
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenInteractive
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] === Token Acquisition (InteractiveRequest) started:
Scopes: https://ZiiDMSAPP.onmicrosoft.com/ZiiDMSWebApi/access_as_user
MSAL: Info False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] [Instance Discovery] Skipping Instance discovery for non-AAD authority.
MSAL: Error False MSAL 4.63.0.0 MSAL.NetCore .NET 8.0.8 Microsoft Windows 10.0.22631 [2024-09-18 05:48:20Z - 110bfb27-5e09-4fd8-8b2a-7a74a85ec1b6] Exception type: System.IO.FileNotFoundException
To see full exception details, enable PII Logging. See https://aka.ms/msal-net-logging
at Microsoft.Identity.Client.Desktop.WebView2WebUi.WebView2WebUiFactory.IsWebView2Available()
at Microsoft.Identity.Client.Desktop.WebView2WebUi.WebView2WebUiFactory.CreateAuthenticationDialog(CoreUIParent coreUIParent, WebViewPreference useEmbeddedWebView, RequestContext requestContext)
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.CreateWebAuthenticationDialog()
at Microsoft.Identity.Client.Internal.AuthCodeRequestComponent.FetchAuthCodeAndPkceVerifierAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.GetTokenResponseAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.InteractiveRequest.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.<>c__DisplayClass11_1.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.Identity.Client.Utils.StopwatchService.MeasureCodeBlockAsync(Func`1 codeBlock)
at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
Could not load file or assembly 'Microsoft.Web.WebView2.Core, Version=1.0.864.35, Culture=neutral, PublicKeyToken=2a8ab48044d2601e'. The system cannot find the file specified.
Relevant code snippets
No response
Expected behavior
Expect it to work like the WinAppSDK 1.5 version which popups the login window
Identity provider
Azure B2C Custom Policy
Regression
No response
Solution and workarounds
No response
The text was updated successfully, but these errors were encountered: