Last post Jul 25, 2019 09:31 AM by Rena Ni
Jul 25, 2019 01:33 AM|Selvakumar Rathinam|LINK
We have have an application configured with Azure b2c.
When user clicks the login link asp.net core application constructs the b2c login url from the appsetting.json configuration values and redirects. before it redirects I wanted to change the redirect_uri query string parameter to something else..
can you guys please advice how can we do this ?
Jul 25, 2019 09:31 AM|Rena Ni|LINK
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");