1

San someone help me fix this problem?

I have

services.AddIdentity<User, IdentityRole>(...)

and then

services.ConfigureApplicationCookie(options =>
            {
                options.Cookie.Name = "somename";
                options.Cookie.Domain = ".somename"

                options.Events = new CookieAuthenticationEvents()
                {
                    OnRedirectToLogin = (context) =>
                    {               
                        context.HttpContext.Response.Redirect("somesite/login/));
                        return Task.CompletedTask;
                    },
                };
                options.ReturnUrlParameter = CookieAuthenticationDefaults.ReturnUrlParameter;
            });

and finally:

services.Configure<SecurityStampValidatorOptions>(options =>
            {
                options.ValidationInterval = TimeSpan.FromSeconds(10);
            });

Authorization takes place on all domains perfectly. But the last service doesn't work as it should. For example, when I update user roles. You need to log out and log in again.

How to fix this problem? Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Are you in the same scene as this one? You can read it, maybe it helps: https://stackoverflow.com/questions/36766191/asp-net-identity-add-another-user-to-role-instantly-they-dont-have-to-log-out – Tupac Oct 08 '21 at 09:32
  • It's work if i not used ConfigureApplicationCookie for subdomain. – Павел Жданов Oct 09 '21 at 15:20

0 Answers0