We use Azure AD B2C tenant and the custom policy. In the custom policy, we prepare 2 ways for sign-in.
- Sign-in with the username and password that registered in AD B2C tenant
- Sign-in with AAD account
In sign-in with AAD account, doesn't show the prompt with Select Account, and executes SSO with some kind of account. But which is not the account the user want to sign-in.
How to show the promot with Select Account?
My code is below (masking sensitive parameter)
IPublicClientApplication ClientApp = PublicClientApplicationBuilder.CreateWithApplicationOptions(
new PublicClientApplicationOptions()
{
ClientId = "<Client ID>",
TicketContainer = KerberosTicketContainer.AccessToken,
})
.WithB2CAuthority($"https://{ TenantName }.b2clogin.com/tfp/{ TenantName }/{ CustomPolicySignUpSignIn }")
.WithRedirectUri($"https://{ TenantName }.b2clogin.com/oauth2/nativeclient")
.Build();
return await ClientApp.AcquireTokenInteractive(new string[] { $"https://{ TenantName }.onmicrosoft.com/<ID>/XXX.fullaccess" })
.WithParentActivityOrWindow(new WindowInteropHelper(this).Handle)
.WithPrompt(Prompt.SelectAccount)
.ExecuteAsync();
Best regards,