-
Notifications
You must be signed in to change notification settings - Fork 10.3k
I want to send a domain_hint from Blazor Web Assembly (using Microsoft.Extensions.DependencyInjection.MsalWebAssemblyServiceCollectionExtensions.AddMsalAuthentication ) #29440 #45468
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
Comments
Hey @szalapski, thanks for reaching out. This may be related to #44973 / #44854. Can you please try out #44854 (comment)? |
Hi @szalapski. 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. |
@TanayParikh, thanks for the response. As instructed, I have added the TrimmerRootDescriptor.xml to the root of my Client project, and added the
No change: still asked to "Pick an account" when signing in via OIDC to Active Directory, even though the only account it knows about is the one that matches mydomain.com. I am on .NET SDK 7.0.100 and package Microsoft.AspNetCore.Components.WebAssembly.Authentication v 7.0.0. Any further ideas? |
@szalapski can you turn on the logs to trace level on your webassembly app? You should be able to see the exact request object being passed down to msal-browser. |
Thanks for the reply, @javiercn -- I got the following. Is there anything wrong with it? If not, any idea why Azure AD's login doesn't take the hint?
Below is the URI that it opens in a popup to start login--shouldn't I expect to see the domain hint in here?
|
@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 |
By this doc as well as this one and this one and this answer, the additional parameter needed is indeed I don't see where to put a breakpoint, as the code you showed me is regular Typescript, but the code my browser sees is minified Javascript. In any case, it doesn't seem necessary as it seems that the signIn-Request object is correct but what MSAL does resulting in a call to Any other ideas? |
@szalapski I would suggest trying to achieve this in a simpler repro that you can tweak with msal.js without going through Blazor. I do not know the specifics of how this is achieved in msal-browser, all I can tell is that the parameters you are passing in from .NET seem to be passed down to the msal call, if that does not result on the behavior you expect, I can't tell if it is because the parameter you are using is not correct or because there is a bug in msal-browser. |
@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. |
That's the ticket. Wow, what a surprise. Every other document refers to "domain_hint". Thank you very much, would never have figured it out otherwise. |
Is there an existing issue for this?
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: #25391 (#25391)
loginHint: #19877 (#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:
Alternatively, it would be acceptable to add explicit parameters for DomainHint and LoginHint.
Or is there some other way to do this that I am missing?
The text was updated successfully, but these errors were encountered: