You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Authentication Popup not closing for MSAL authentication extension #2692
When LoginAsync is called using the Authentication service, the popup doesn't send the token back to the main window, but instead sends it to a new page inside the popup.
After looking in the logs I found this error:
dbug: Uno.Extensions.Authentication.MSAL.MsalAuthenticationProvider[0]
LoginAsync - Error attempting to login [Error - Popup closed]
Expected behavior
The token is sent back to the main window, and the popup closes
How to reproduce it (as minimally and precisely as possible)
@kazo0 I'm trying to repro this issue but I'm getting something totally different. When the msal popup opens and I try to login I get an error message about redirect uri. It may be something wrong with my setup.
@kazo0 I'm trying to repro this issue but I'm getting something totally different. When the msal popup opens and I try to login I get an error message about redirect uri. It may be something wrong with my setup.
At present time dotnet/runtime#109937 forces COOP, which breaks any kind of cross site behavior. There are multiple ways around it, until this issue is fixed:
Use an uno "server" project which will host the website on its own, and will not have COOP enabled. Wasm Debugging may not work as intended in that context, though, but starting it without the debugger will work and hot design will work properly.
Use dotnet serve on the CLI, but in this case, there's no support for hot design, nor debugging.
I have validated with the sample app that @erikvilima has provided that running the app via dotnet serve from the wwwroot folder in the bin/ that it is working with that method
It also works by using a Server project and launching the app through that. For this, I create a new Uno app through the Wizard and selected the Server project in Features:
and ran a dotnet publish for the Server project and launched from the Release/bin/publish/wwroot folder
I will keep this issue to track the documentation change we should be adding immediately to call this out in the Extensions MSAL docs and the general MSAL Uno docs
The workaround to be documented means no debugging in WASM ?
So the issue is a blocker for debugging, and the resolution discussed above is a workaround that also blocks debugging, then we are left with no debugging for wasm apps that use the authentication extension.
The .NET 9 defect dotnet/runtime#109937 which causes this is open since Nov 2024, and we are now close to .NET 10. This does not inspire confidence that Microsoft will fix this in a reasonable time frame.
Q: Is there any other workaround conceivable (e.g. in the authorization extension) that does give us debugging authenticated wasm apps? Is the issue fixed in .NET 10 perhaps?
Q: Is there any other workaround conceivable (e.g. in the authorization extension) that does give us debugging authenticated wasm apps? Is the issue fixed in .NET 10 perhaps?
FYI @VincentH-Net / @cosymon it looks like the blocking issue was just recently fixed in .NET 10! I would expect the fix to be available in an upcoming RC1
Activity
VincentH-Net commentedon May 26, 2025
I have the same issue, .NET SDK 9.0.300 and Uno SDK 6.0.96, target
net9.0-browserwasm, on opening the login windows this exception occurs:After selecting an account the login popup does not close and the app appears in the login popup
When changing the target to
net8.0-browserwasm;it works.This is a blocking issue for upgrading my app to .NET 9, which prevents me from using Hot Design (because Hot Reload only works on .NET 9)
erikvilima commentedon May 28, 2025
@kazo0 I'm trying to repro this issue but I'm getting something totally different. When the msal popup opens and I try to login I get an error message about redirect uri. It may be something wrong with my setup.
This is my repro app.
nativeExtensions2692.zip
erikvilima commentedon May 29, 2025
I can repro the issue. We are investigating the cause.
trydalch commentedon Jun 3, 2025
Hi @erikvilima. Thanks for looking at this. Do you have any update?
kazo0 commentedon Jun 6, 2025
@trydalch
Still investigating, it seems related to the
Cross-Origin-Opener-Policyand multi-threading in net9 maybe?Relevant:
If we perhaps play around with some of the msbuild properties mentioned in the links above, testing to see if those have any effect
jeromelaban commentedon Jun 6, 2025
At present time dotnet/runtime#109937 forces COOP, which breaks any kind of cross site behavior. There are multiple ways around it, until this issue is fixed:
dotnet serveon the CLI, but in this case, there's no support for hot design, nor debugging.erikvilima commentedon Jun 9, 2025
nativeExtensions2692.zip
kazo0 commentedon Jun 9, 2025
FYI @cosymon / @VincentH-Net / @trydalch See Jerome's comment
I have validated with the sample app that @erikvilima has provided that running the app via
dotnet servefrom thewwwrootfolder in thebin/that it is working with that methodIt also works by using a Server project and launching the app through that. For this, I create a new Uno app through the Wizard and selected the Server project in Features:
and ran a
dotnet publishfor the Server project and launched from the Release/bin/publish/wwroot folderI will keep this issue to track the documentation change we should be adding immediately to call this out in the Extensions MSAL docs and the general MSAL Uno docs
carldebilly commentedon Jun 9, 2025
The publish is not required to run the project locally in DEV...
VincentH-Net commentedon Jun 10, 2025
Thanks for all the investigations @erikvilima ; do I understand correctly that:
dotnet publishSo the issue is a blocker for debugging, and the resolution discussed above is a workaround that also blocks debugging, then we are left with no debugging for wasm apps that use the authentication extension.
The .NET 9 defect dotnet/runtime#109937 which causes this is open since Nov 2024, and we are now close to .NET 10. This does not inspire confidence that Microsoft will fix this in a reasonable time frame.
Q: Is there any other workaround conceivable (e.g. in the authorization extension) that does give us debugging authenticated wasm apps? Is the issue fixed in .NET 10 perhaps?
Thanks!
VincentH-Net commentedon Aug 12, 2025
@kazo0 any plans / tips to unblock?
No debugging on .NET 9 means production wasm apps that use the auth extension are stuck on .NET 8; mine has been for months.
kazo0 commentedon Aug 15, 2025
FYI @VincentH-Net / @cosymon it looks like the blocking issue was just recently fixed in .NET 10! I would expect the fix to be available in an upcoming RC1