Hi Hector Meneses @ BMG ,
Thanks for your post! To redirect a user back to the application after selecting the "Cancel button", you will either need to catch the error message or hide the Cancel button via JavaScript/CSS. You could replace it with a button that sends the user back.
When you call a sign-in policy, the redirect URI will be included in the URL. After you click the Cancel button, the user will be redirected to the URL you added.
You need to catch the error and redirect the user where you want. The error is handled by the application based on the code sent back. For example,
if (notification.Exception.Message == "access_denied")
{
notification.Response.Redirect("/");
}
There are several code examples shared in this thread, including an msal-react example.
If the information helped you, please Accept the answer. This will help us and improve searchability for others in the community who may be researching similar questions.