I am using openiddict for custom sso and want to host login ui on a separate domain in spa application. The issue I am facing is propper configuration of challenge action.
I've tried to overwrite OnRedirectToLogin event but that obviously not working
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options =>
{
options.Events = new CookieAuthenticationEvents()
{
OnRedirectToLogin = async (context) =>
{
context.HttpContext.Response.Redirect("https://example.com/account/login");
}
};
});
Am I doing smth wrong?