User711641945 posted
Hi Selvakumar,
You could not change the redirect_uri since the redirect_uri in the asp.net core 2.2 and azure application portal should match the same.
If you only change the rediect_uri at asp.net core, it will fail to authenticate.
For another way, you could attach your query string in the state like below:
services.Configure<OpenIdConnectOptions>(AzureADB2CDefaults.AuthenticationScheme, options =>
{
options.Events = new OpenIdConnectEvents
{
OnRedirectToIdentityProvider = async n =>
{
//set your query stirng here to state
n.ProtocolMessage.State = n.HttpContext.Request.Path.Value.ToString();
},
OnTokenValidated = ctx =>
{
//get state from response
var url = ctx.ProtocolMessage.GetParameter("state");
return Task.CompletedTask;
},
};
});
Best Regards,
Rena