Closed
Description
Description
I am using the MSAL authentication with Azure AD trying to add prompt parameter to the sign in. It does not work as expected.
The observed request https://login.microsoftonline.com/common/oauth2/v2.0/authorize?...
doesn't contain the prompt parameter and the request just completes with SSO.
Reproduction Steps
RedirectToLoginSelectAccount.razor
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
@inject NavigationManager Navigation
@code {
protected override void OnInitialized()
{
var requestOptions = new InteractiveRequestOptions()
{
Interaction = InteractionType.SignIn,
ReturnUrl = Navigation.Uri,
};
requestOptions.TryAddAdditionalParameter("prompt", "select_account");
Navigation.NavigateToLogin("authentication/login", requestOptions);
}
}
The following weird version works on development build in VS, but doesn't work in published release build.
var extraQueryParametersDictionary = new Dictionary<string, string> { ["prompt"] = "select_account" };
requestOptions.TryAddAdditionalParameter("extraQueryParameters",
JsonSerializer.Deserialize<JsonElement>(JsonSerializer.Serialize(extraQueryParametersDictionary)));
Expected behavior
Authentication to include the prompt parameter.
Actual behavior
Prompt parameter missing.
Regression?
No response
Known Workarounds
No response
Configuration
7.0.101 [C:\Program Files\dotnet\sdk]
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-rtm.22512.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-rtm.22512.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.Authentication.WebAssembly.Msal" Version="7.0.0-rtm.22512.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0-rtm.22511.4" />
Other information
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
ghost commentedon Nov 2, 2022
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
juho-hanhimaki commentedon Nov 2, 2022
Wrong repo, perhaps somebody can transfer to aspnetcore?
juho-hanhimaki commentedon Nov 3, 2022
I am pretty sure this is a bug. Hopefully someone can take a look and reproduce. I don't think I am able to test using the newer rtm.22513.3 packages as they complain about downgrades from 7.0.0 (which isn't out yet).
#42580
https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/additional-scenarios?view=aspnetcore-7.0#customize-the-login-process
TanayParikh commentedon Nov 3, 2022
We're also using that workaround in the test code:
aspnetcore/src/Components/WebAssembly/WebAssembly.Authentication/test/RemoteAuthenticationServiceTests.cs
Line 419 in 2e29720
This appears to be a known issue, @javiercn do you have a tracking issue for this, or is the workaround (also mentioned here) the recommended resolution for now? Note for the workaround, @juho-hanhimaki mentioned:
TanayParikh commentedon Nov 10, 2022
@javiercn just to confirm the next steps here, were there any changes made following the community standup which may not have flowed through / may not have been comprehensive? Or are we just initially investigating?
1 remaining item
javiercn commentedon Nov 10, 2022
@TanayParikh this is worth investigating.
There are some issues I think with the way we do Json serialization internally and some linking related issues.
javiercn commentedon Nov 11, 2022
I believe this is likely caused by the same issue as #44973
javiercn commentedon Nov 11, 2022
@juho-hanhimaki try disabling linking for this assembly
Add this to your csproj
And this is TrimmerRootDescriptor.xml:
ghost commentedon Nov 11, 2022
Hi @juho-hanhimaki. 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.
juho-hanhimaki commentedon Nov 11, 2022
@javiercn that does solve the problem.
javiercn commentedon Nov 11, 2022
@juho-hanhimaki thanks for the confirmation.
This looks very much like the same issue then. Hopefully we can get a fix into the next patch.
javiercn commentedon Dec 15, 2022
this was addressed in 7.0.1 as part of #45028