Repository navigation
Description
Current behavior
When click on button Login a NullReferenceException is thrown:
fail: Uno.UI.Dispatching.NativeDispatcher[0]
NativeDispatcher unhandled exception
System.NullReferenceException: Object reference not set to an instance of an object.
at IdentityModel.Client.AuthorizeResponse.ParseRaw()
at IdentityModel.Client.AuthorizeResponse..ctor(String raw)
at IdentityModel.OidcClient.OidcClient.ProcessResponseAsync(String data, AuthorizeState state, Parameters backChannelParameters, CancellationToken cancellationToken) in //src/OidcClient/OidcClient.cs:line 187
at IdentityModel.OidcClient.OidcClient.LoginAsync(LoginRequest request, CancellationToken cancellationToken) in //src/OidcClient/OidcClient.cs:line 87
at Uno.Extensions.Authentication.Oidc.OidcAuthenticationProvider.InternalLoginAsync(IDispatcher dispatcher, IDictionary2 credentials, CancellationToken cancellationToken) at Uno.Extensions.Authentication.BaseAuthenticationProvider.LoginAsync(IDispatcher dispatcher, IDictionary2 credentials, CancellationToken cancellationToken)
at Uno.Extensions.Authentication.AuthenticationService.LoginAsync(IDispatcher dispatcher, IDictionary2 credentials, String provider, Nullable1 cancellationToken)
at UnoApp1.Presentation.LoginViewModel.DoLogin() in C:\Temp\UnoApp1\UnoApp1\Presentation\LoginViewModel.cs:line 25
at CommunityToolkit.Mvvm.Input.AsyncRelayCommand.AwaitAndThrowIfFailed(Task executionTask)
at System.Threading.Tasks.Task.<>c.b__128_0(Object state)
at Uno.UI.Dispatching.NativeDispatcherSynchronizationContext.<>c__DisplayClass3_0.b__0() in C:\a\1\s\src\Uno.UI.Dispatching\Native\NativeDispatcherSynchronizationContext.cs:line 21
at Uno.UI.Dispatching.NativeDispatcher.RunAction(NativeDispatcher dispatcher, Action action) in C:\a\1\s\src\Uno.UI.Dispatching\Native\NativeDispatcher.cs:line 153
Regardless of the exception, the login windows is opened and I'm able to login into the demo's Duende Server.
But when the callback is executed, the user is not recognized (not logged in)
Expected behavior
The user should be logged in after providing the right credentials in the Duende Server.
How to reproduce it (as minimally and precisely as possible)
The attached project has been created using Uno's templates with OIDC Authentication against Duende's demo server.
After running, press the Login button and check the output window in Visual Studio to see the exception.
Verify that the user is not authenticated:
Title += $" - Is Authenticated: {authentication.IsAuthenticated()}";
Environment
Nuget Package (s):
Package Version(s):
Affected platform(s):
- iOS
- macOS (AppKit)
- Mac Catalyst
- Android
- WebAssembly
- Windows
- Skia (WPF)
- Skia (GTK on Linux/macOS/Windows)
- Skia (Linux Framebuffer)
- Build tasks
Visual Studio:
- 2019 (version: )
- 2022 (version: )
- Visual Studio Code (version: )
- Rider Windows (version: )
- Rider macOS (version: )
Relevant plugins:
- Resharper (version: )
Activity
DevTKSS commentedon Jul 29, 2025
could the version / Rebranding be causing this? Uno is using the version before the rebranding at this release:
abbatepabloo commentedon Jul 29, 2025
If I understood correctly from the breaking change, this assembly shouldn't be present:
Instead Duende.IdentityModel should be referenced.
Am I right, or am I getting lost somewhere?
DevTKSS commentedon Jul 30, 2025
@abbatepabloo this is what the linked PR is updating 👍 But as its a Breaking change, it can only be merged with the next major version.
@kazo0 will maybe be able to tell you more about this or help you, isnt it?
DevTKSS commentedon Jul 30, 2025
how do you get to the form? I tryed on my side with a valid api and api key setup (oAuth2 no oidc) and wether on Desktop, nor Webassembly or Android, or windows does do anything...
DevTKSS commentedon Jul 30, 2025
breaking also on Desktop with StackOverflowException (no Details in Exception provided)
Wasm also seems to come from Native dispatcher and Source generators?
Output-Debug.txt
kazo0 commentedon Jul 31, 2025
@abbatepabloo / @DevTKSS thanks for the reports and the helpful attached sample apps and testing!
Definitely something we need to investigate. I have set it to be prioritized for upcoming release iterations. I have also logged a couple issues surrounding Auth that will hopefully address some of this in terms of guidance as well as steps forward for the current reliance on IdentityModel for the OIDC Auth Extensions:
#2875
#2876
kazo0 commentedon Oct 10, 2025
@abbatepabloo if you were to target net10 instead of net9 for the app, does it work? I believe this is the same issue as unoplatform/uno#21585
You can try moving to targetting net10.0 and you may need to temporarily add
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>to your csprojDevTKSS commentedon Oct 30, 2025
@kazo0 with which uno.sdk (dev?) version could this be re-tested after
is stated to be merged from the PR? Not sure how to overwrite normally uno.sdk managed uno packages 🤔
[-]OIDC Authentication doesn't seem to work on Wasm[/-][+][Auth] OIDC Authentication doesn't seem to work on Wasm[/+][-][Auth] OIDC Authentication doesn't seem to work on Wasm[/-][+][Auth][OIDC] Authentication doesn't seem to work on Wasm[/+]