Skip to content

Blazor WebAssembly Msal TryAddAdditionalParameter does nothing #48136

@jlavery416

Description

@jlavery416

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I'm using MSAL authentication in a Blazor WASM app that supports multi-tenancy. To determine the tenant, I am attempting to attach the tenant the user has indicated as a query parameter to the authorization request being sent to an Azure AD B2C custom policy. However, I cannot get the TryAddAdditionalParameter() method on an InteractiveOptionsRequest to successfully add query parameters.

I believe I may be missing something--as this problem has already been reported in #44854, and a solution was reportedly introduced in #45028 that was included in 7.0.1--but I'm not sure what that would be.

The temporary workaround proposed in #45028 (adding a TrimmerRootDescriptor) does not work for me either.

The only way I can add the parameters is to do as the reporter in #44854 suggests and serialize and deserialize a dictionary to pass into TryAddAdditionalParameter(), but my understanding is that that will fail during a release build.

Any help would be greatly appreciated.

Expected Behavior

I expect whatever key and value I pass into TryAddAdditionalParameter() to be added onto the end of the authorize request.

Steps To Reproduce

Here's a minimal repo to see what I'm attempting to do and where it is failing: https://github.com/jlavery416/QueryParamsMinimalRepo

To run, you'll need to fill in the AzureAd settings with a set up b2c instance that has a custom policy you can reach, or you can set MSAL up for a different provider.

Again, all I'm trying to achieve is to see my parameters set on the authorize request.

Thanks again for any help y'all can provide.

Exceptions (if any)

No response

.NET Version

7.0.203

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-blazorIncludes: Blazor, Razor Componentsfeature-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