-
Notifications
You must be signed in to change notification settings - Fork 217
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
ITokenAcquisition.GetTokenForUser() needs to take an optional userFlow parameter #27
Comments
moving some of the required cache look up to MSAL .NET |
@jackheywood @grzegorzy @felickz This work-in-progress branch has some changes to how Microsoft Identity Web handles b2c, including a fix for this issue, which involves taking a userFlow parameter in In Microsoft Identity Web, we are using the HttpContext to determine the current userFlow, and using that userFlow . For example, I do su_si policy first, then I go to edit_profile. Then I hit "call the web API", Microsoft Identity Web will use the current userFlow, which is edit_profile,, which is incorrect because my web API is behind the su_si userFlow, we then catch an MsalUiRequiredException and use the su_si policy. However, If you want to specify the policy to use, you cannot do that, as mentioned here. The branch linked above has the ability to specify the policy. You'll need to do two things to try it out.
[AuthorizeForScopes(ScopeKeySection = "TodoList:TodoListScope", UserFlow = "b2c_1_susi")]
private async Task PrepareAuthenticatedClient(string userFlow)
{
// Each user flow is a separate authorization server.
// specify which user flow is connected to the web API.
var accessToken = await _tokenAcquisition.GetAccessTokenForUserAsync(new[] { _TodoListScope, }, userFlow:userFlow);
Debug.WriteLine($"access token-{accessToken}");
... cc: @jmprieur |
@jackheywood @grzegorzy @felickz This was included in Microsoft Identity Web 0.2.1-preview release. |
Thank you very much for the notification @jennyf19, @pmaytak. I checked the latest 0.2.1-preview release. Unfortunately it seems that it doesn't solve my issue Cannot acquire API access token for B2C Reset Password policy. I used the MSAL.NetCore.4.16.1.0.MsalUiRequiredException: My assumption after the 0.2.1-preview release and according to what @jennyf19 said here was that I tried to quickly check it in the source code and I noticed one thing. Take a look at the Perhaps I am doing something wrong. Perhaps I should create a separate issue instead of writing here. I just wanted to give you guys some feedback. cc: @jmprieur |
Thanks for the heads up @grzegorzy |
No problem @jmprieur! |
Why?
Today we don't specify in the controllers which policy/user flow to use to acquire the token, and therefore the B2C scenarios is not quite right.
What?
Expose a userFlow parameter and lookup the right account in the implementation
See also the 2 related issues
The text was updated successfully, but these errors were encountered: