Skip to content

net7 Blazor WASM AAD authentication ends with There was an error trying to log you in: '"undefined" is not valid JSON' #44981

Closed
@hakenr

Description

@hakenr

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Sample project: https://github.com/havit/Bonusario

When upgraded from net6 to net7 the application started to fail with

` There was an error trying to log you in: '"undefined" is not valid JSON'

right after logging in to Azure AD (end of auth workflow).

Applies only for published version, does not occur in development.

After several attempts I found that disabling assembly trimming for Microsoft.AspNetCore.Components.WebAssembly.Authentication resolves the issue.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

7.0.100

Anything else?

Workaround

Add

<assembly fullname="Microsoft.AspNetCore.Components.WebAssembly.Authentication" preserve="all" />

to your TrimmerRootDescriptor.xml.

See https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.feature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyfeature-blazor-wasm-auth

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions