-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Support for extraQueryParameters in Blazor WASM / MSAL #25391
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
The extra query parameters are also needed when calling an API that requires interaction: https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-conditional-access-dev-guide#scenario-app-performing-the-on-behalf-of-flow. |
This is also essential to allow the use of "id-token-hint" |
Any chance of an update on this? I've worked on three Blazor projects now where we've had to come up with ugly workarounds. I know this might seem minor, but adding this would bring so much joy to so many people's lives! (Well, mine. But I'm sure others too.) |
Does #42580 cover this with it's Dynamic/Extensible approach? |
Hey @danroth27, From my testing today, the #42580 does not resolve the issue of adding "custom" parameters. var request = new InteractiveRequestOptions { Interaction = InteractionType.SignIn, ReturnUrl = Navigation.Uri };
request.TryAddAdditionalParameter("random", "value"); But the "random" parameter does not get added to the authentication. Edit: On a side note, if I would instead do request.TryAddAdditionalParameter("extraQueryParams", "value"); It would end up write the string |
@iXyles There were some known issues with dynamic authentication requests and MSAL in .NET 7 RC1. Can you try again with .NET 7 RC2, which was recently released? |
@danroth27 Did a quick test, and the issue is still persistent sadly. Extra query parameters are split up similarly to what I showed above, and custom parameters are not included in the request sent to the IDP. |
@iXyles the code needs to be something like this: var extraQueryParametersDictionary = new Dictionary<string, string>
{
["brand_color"] = "red"
};
request.TryAddAdditionalParameter("extraQueryParameters", JsonSerializer.Deserialize<JsonElement>(JsonSerializer.Serialize(extraQueryParametersDictionary))); |
@javiercn sadly this did not work, the parameter does not get passed when I am testing it locally with RC2. |
@iXyles this issue is for Azure AD B2C, which uses MSAL.JS. In your case you seem to be using a different provider, which uses oidc-client.js. The parameter name there is |
@javiercn Ah right... Forgot that little detail. Thanks for noticing that and cheers for showing a solution to the issue! :) |
Issue
I would like to pass a query parameter to a B2C user flow when authenticating my Blazor client app. The query parameter could be used, for example, to change the content on the login screen or lots of other useful things
B2C supports this through their IdentityExperienceFramework. Specifically, you can add the following to your user flow:
MSAL also supports extra parameters using the "extraQueryParameters" type in AuthenticationParameters (https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-pass-custom-state-authentication-request)
It appears WASM.Authentication.Msal does not provide access to extraQueryParameters.
Solution I'd like to see
Ideally, I would like the following behavior:
Other Info
I think I could achieve a similar result with a"loginHint" but WASM.Authentication.Msal doesn't appear to support this either. The use of extraQueryParameters would provide the most flexibility. I have not been able to find any interim solution that lets me pass custom state info from my blazer app to a b2c userflow (I hope I am not missing something obvious :- ) )
The text was updated successfully, but these errors were encountered: