we are using custom SignUpSignIn policy with social Idps and localAccount options.
when a user clicks on signUp and after entering some details in the form and then decides to cancel the process by clicking the "Cancel" button, we are getting an error
https://example.com/#error=access_denied&error_description=AADB2C90091%3a+The+user+has+cancelled+entering+self-asserted+information.%0d%0aCorrelation+ID%3a+c55fc20c-d296-42ed-8eea-2857d8d8d44b%0d%0a
Please let me know how to handle this in case of 1) local Account Registration 2) social Idp's (Facebook, Google..)
Can we do anything at the policy level or while registering the applications. Please let me know
Thanks,
The idea behind getting those error codes is to catch them and redirect to where you consider. Could be again to the sign-up or sign-in page, etc.
I believe the previous response is correct. The error is handled by the application based on the code sent back. For example, in an MVC app in the startup.auth.cs add the following to tell the application where to send the user:
private Task AuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
{
notification.HandleResponse();
if (notification.ProtocolMessage.ErrorDescription != null && notification.ProtocolMessage.ErrorDescription.Contains("AADB2C90091"))
{
// If the user clicked the cancel button, redirect to default route
notification.Response.Redirect("/");
}
else if (notification.ProtocolMessage.ErrorDescription != null && notification.ProtocolMessage.ErrorDescription.Contains("AADB2C90118"))
{
// If the user clicked the reset password link, redirect to the reset password route
notification.Response.Redirect("/Home/ResetPassword");
}
else if (notification.Exception != null && notification.Exception.Message == "access_denied")
{
notification.Response.Redirect("/");
}
else
{
notification.Response.Redirect("/Home/Error?message=" + notification.ProtocolMessage.ErrorDescription);
}
return Task.FromResult(0);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With