I want to send a domain_hint from Blazor Web Assembly (using Microsoft.Extensions.DependencyInjection.MsalWebAssemblyServiceCollectionExtensions.AddMsalAuthentication ) #29440
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Issue reference: https://stackoverflow.com/questions/63605653/is-there-a-way-to-supply-a-domain-hint-for-single-sign-on-using-msal-net-on-a-bl
domain_hint is a AuthenticationParameter of MSAL, which does not appear to be supported/exposed by the Microsoft.Authentication.WebAssembly.Msal package
Here are related issues for other Authentication parameters: extraQueryParameter: https://github.com/dotnet/aspnetcore/issues/25391 (https://github.com/dotnet/aspnetcore/issues/25391) loginHint: https://github.com/dotnet/aspnetcore/issues/19877 (https://github.com/dotnet/aspnetcore/issues/19925)
I believe this issue was unfairly closed with the suggestion that we could customize our own msal.js library. This is not the case; msal.js supports domain hints, it is the .NET MSAL library that doesn’t pass it through.
Describe the solution you’d like
I would hope that simply adding support for additional parameters, which will be passed through to MSAL.JS, would be easy to implement, test, and support. So in my client Program.cs, I could do:
WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);
...
builder.Services.AddMsalAuthentication(options =>{
...
options.ProviderOptions.AddAdditionalProviderParameter("domain_hint","mydomain.com");
});
Alternatively, it would be acceptable to add explicit parameters for DomainHint and LoginHint.
...
options.ProviderOptions.DomainHint = "mydomain.com";
Or is there some other way to do this that I am missing?
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (6 by maintainers)
@szalapski I took another look, I think you should use “domainHint” and not “domain_hint” as per https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_browser.html#redirectrequest
If you still have issues after that, please let us know. I’ve created an issue to bring more clarity in the docs about this scenario.
@szalapski I am not sure about the specific way to achieve this in MSAL, my guess is that you are likely not passing the correct parameter downstream. If you want to know for sure, you can put a breakpoint on the JS right before the call to sign-in in MSAL and inspect that the values are what you expect.
What you see in the trace is literally what gets passed to msal-browser here