-
Notifications
You must be signed in to change notification settings - Fork 10k
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
.NET 8 preview7 Blazor WASM AAD authentication ends with There was an error trying to log you in: '"undefined" is not valid JSON' #49956
Comments
Thanks for contacting us. We're moving this issue to the |
I'm getting a similar behavior ("undefined" is not valid JSON') but in this case I'm using Azure ADB2C with an IdentityServer4 external provider.
but the issue is still there. Any suggestions would be appreciated. |
@halter73 isn't this something you've addressed already (your PR to the some AAD library I think) ? |
In the
I believe this should not be classified as "technical debt" for future ".NET 9 Planning", but rather recognized as a regression that could potentially cause significant issues for users. |
I experienced the same issue when upgrading to .NET 8.0 with Azure B2C. I had to add the following to get it to work.
Specifying just Microsoft.Authentication.WebAssembly.Msal alone did not work for me. |
@kyleherzog Sorry for the confusion. Actually I do have both the MSAL and WebAssembly.Authentication rooted and it is probably the |
I can confirm. The issue is solved in our case by mentioning only one root assembly:
|
i have same problem,but i don't know how to fix it. nomatter i add |
Using Net8.0, TrimmerRootAssembly does not fix the issue. |
Thanks for contacting us. We're moving this issue to the |
Something that caught me out was I also needed to clear cache after adding
Edit: This actually didn't fix it. |
@martinblampied could you please check if you need both assemblies listed ? For me, it worked nicely listing only Microsoft.AspNetCore.Components.WebAssembly.Authentication |
@czlatea Doesn't work for me; tried both and just Authentication in both Client and Server projects using .net 8 |
Same issue on .NET 8 and I have tried adding both to the trimmer exception. Pushing this to .NET 9 is unacceptable. This has been going on long enough. It's been years now. |
Had the same issue. Going from .NET 7 -> .NET 8, I had to add the following in the Client csproj:
This resolved the issue. Another thing I noticed was that it was only in Microsoft Edge the problem occured, in Google Chrome there was never an issue. |
Hi @markushaslinger. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@halter73 I forked your repo and set it up like my project, relevant changes:
After these changes (+ entering my own tenant and client of course) and running Don't think my setup is totally unusal, but please tell me if I'm doing something I'm not supposed to do (the redirect is a requirement though, can't change that). I hope that helps you to reproduce the issue! |
Hi @halter73. Many of us in this thread only experienced the issue when we deployed to Azure, localhost worked fine. FWIW (to help reproduce) - I had this issue after following the steps here https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-microsoft-entra-id Solution runs fine on my localhost but shows the JS error once deployed to Azure. The same workaround works for me. <ItemGroup>
<TrimmerRootAssembly Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication"/>
</ItemGroup> |
Is this expected to be folded in to the 8.0.4 release? |
For anyone following along, I had a similar issue here #54515 that I was hoping would be fixed with 8.0.4. I updated and that does not seem to be the case. Can we stop closing tickets until something is confirmed as fixed AND released? I even asked in my other issue how I'd confirm that this works locally so I don't have to do a full build and deploy, but no dice. |
pls fix |
Hoping this gets fixed soon. Loading app state from an encoded URL (like in #54514 ) has been broken for months in our app and is a pretty basic/critical feature to be broken for so long. |
Key functionality (authentication) of a framework (in this case Blazor) being shipped completely broken out of the box in an LTS release when you've known about it since preview builds is completely unacceptable, closing an issue when it is NOT fixed, and expecting users to jump through hoops to find a CLOSED GitHub issue with a workaround is even worse. Doing things like that, alongside other shortcomings of auth in Blazor (like using a deprecated version of oidc-client-js) basically ensures Blazor will never see serious adoption. |
It looks like the fix might be included in the upcoming 8.0.5, which based on the release cadence so far, I'd guestimate that it'll be out on May 7th You're right though, they really need to do something about the underlying oidc-client, there hasn't been a release of it since 2021 and the repo was archived in March 2022, the replacement oidc-client-ts is actively maintained, regularly updated and well supported - they really do need to do something. |
@milkyjoe90 afaik patches come out the second Tuesday of each month (but are not guaranteed), so that would be May 14th. Takes a bit for things to propagate (like packages getting posted to NuGet and what not), so I'd just check the 15th. |
Ahhh Patch Tuesday, of course! Can’t believe I missed that! Lines up perfectly with all the other MS patches that get released! |
Steps:
when running locally it runs fast and no refresh issues or anything. when deployed to Azure - after B2C login redirect, we are returned to index.razor ("/") and the user is authenticated but does not Navigate to "/user" however, if we manually refresh the page it successfully checks (B2Cuser.Identity.IsAuthenticated) and Navigates to "/user" I am in process of adding... UPDATE 13 May 2024I also updated all the relevant nuget packages ( we use Blazor ) to 8.0.4 AND it works fine now on our deployed Azure WebApp. |
Did not work for me on 8.0.4 but it works now after updating to 8.0.5 packages 🎉 Also tested if the returnUrl is fixed but this does not redirect to the return Url (RedirectToLogin.razor)
So I still have to have this workaround in RedirectToLogin.razor for preserving the returnUrl and redirecting on login
|
Cool, fixed for me using Microsoft.Authentication.WebAssembly.Msal 8.0.7, I've removed the TrimmerRootAssembly workaround. |
I created a new Blazor WASM app that uses Azure AD B2C using Everything works fine locally. I'm hosting the app on Azure using Static Web App service and clicking the Login link does nothing, except for throwing this error: If basic login doesn't work, this is a show stopper for us to use Blazor WASM! I'd appreciate any suggestions. Thanks! |
@imsam67 have you upgraded Microsoft.Authentication.WebAssembly.Msal NuGet package to the latest version? |
I'm using version 8.0.8, same as the WebAssembly package version. |
Is there an existing issue for this?
Describe the bug
I am getting the same issue as described in #44981 again: after coming back from login at Azure AD the user sees 'There was an error trying to log you in: '"undefined" is not valid JSON'' at the 'authentication/login-failed' route.
However, after manually navigating around the token is available so it kind-of worked anyway.
Same as with the previous issue, adding the following solves the issue, so I suspect a similar cause:
Also: error does not appear during development, only after publish also pointing to the linker
Expected Behavior
No error should be displayed after the redirect if the operation was successful.
Steps To Reproduce
Standard Blazor WASM application using
Microsoft.Authentication.WebAssembly.Msal
(8.0.0-preview.7.23375.9), set up to use 'redirect' and not the 'pop up' auth option.Exceptions (if any)
No response
.NET Version
8.0.100-preview.7.23376.3
Anything else?
No response
The text was updated successfully, but these errors were encountered: