azure adb2c password reset redirect uri fails

45 Views Asked by At

I have asp.net MVC 4.8 application and user Azure ADB2C. I could not get custom policy B2C_1A_PASSWORDRESET to work. Then I tried to use user flow B2C_1_PASSWORDRESET and formed b2cResetPasswordUrl by using oauth2/v2.0/ and adding &redirect_uri=https://localhost:44313/signin-oidc at the end.

Although password reset works fine however redirecting back to my website errors out with /signin-oidc 404.

Sigin and password reset works fine. redirect_uri set as https://localhost:44313/signin-oidc (Globals.RedirectUri) for the web application. But password reset redirect still errors with 404.

app.UseOpenIdConnectAuthentication(
     new OpenIdConnectAuthenticationOptions
     {
         ClientId = Globals.ClientId,
         Authority = Globals.B2CAuthority,
         PostLogoutRedirectUri = Globals.RedirectUri,                 
         RedirectUri = Globals.RedirectUri,
         CallbackPath = new PathString("/signin-oidc"),
         Notifications = new OpenIdConnectAuthenticationNotifications()
         {
             SecurityTokenValidated = (context) =>
             {
                 string name = context.AuthenticationTicket.Identity.FindFirst("name").Value;
                 context.AuthenticationTicket.Identity.AddClaim(new Claim(ClaimTypes.Name, name, string.Empty));
                 return System.Threading.Tasks.Task.FromResult(0);
             },
             AuthenticationFailed = OnAuthenticationFailed
         }                    
     });

Any help appreciated. Thanks

0

There are 0 best solutions below