Hi @Manish Pandit ,
Thanks for reaching out.
This error is due to tokens which are retrieved for particular policy are not matching with that policy.
For different signup option, you need to pass Azure AD B2C policy Id for each action. The action passes a parameter named policy to authentication library which will allows you to provide the correct Azure AD B2C policy ID for the specific action.
public IActionResult SignUp_Customer([FromRoute] string scheme)
{
scheme ??= OpenIdConnectDefaults.AuthenticationScheme;
var redirectUrl = Url.Content("~/");
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
properties.Items["policy"] = "B2C_1A_SIGNUP_SIGNIN";
return Challenge(properties, scheme);
}
public IActionResult SignUp_Guest([FromRoute] string scheme)
{
scheme ??= OpenIdConnectDefaults.AuthenticationScheme;
var redirectUrl = Url.Content("~/");
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
properties.Items["policy"] = "B2C_1A_SIGNUP_SIGNIN_GUEST";
return Challenge(properties, scheme);
}
You need to make sure you to select the correct Account object in respect to the authority and use that against the matching SignUp B2C policy.
Hope this will help.
Thanks,
Shweta
------------------------------------
Please remember to "Accept Answer" if answer helped you.