Asp.net core 饼干';。AspNetCore.Identity.Application';已设置';SameSite=无';还必须设置';安全';

Asp.net core 饼干';。AspNetCore.Identity.Application';已设置';SameSite=无';还必须设置';安全';,asp.net-core,identity,Asp.net Core,Identity,我遵循了这些链接: https://www.thinktecture.com/en/identity/samesite/prepare-your-identityserver/ https://www.thinktecture.com/en/identity/samesite/how-to-delete-samesite-cookies/ 这些是我的设置: services.AddIdentityServer() .AddApiAuthorization<

我遵循了这些链接:

https://www.thinktecture.com/en/identity/samesite/prepare-your-identityserver/
https://www.thinktecture.com/en/identity/samesite/how-to-delete-samesite-cookies/
这些是我的设置:

        services.AddIdentityServer()
         .AddApiAuthorization<ApplicationUser, ApplicationDbContext>();


        services.AddAuthentication()
            .AddIdentityServerJwt();

        services.ConfigureNonBreakingSameSiteCookies();

        // Adjust to this (or similar)
        services
           .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
           .AddCookie(options =>
           {
               // add an instance of the patched manager to the options:
               options.CookieManager = new ChunkingCookieManager();
           });

我正在尝试通过http运行identity。我在设置某些cookie(但不是所有cookie)时出现这些错误,并且我完全无法删除chrome中的cookie,代码中的一切都正常,但您应该更多地配置cookie

AddCookie
中添加其他属性-
Secure
HttpOnly
SameSite
。更多信息请访问

例如:

        services
           .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
           .AddCookie(options =>
           {
               // add an instance of the patched manager to the options:
               options.CookieManager = new ChunkingCookieManager();

                options.Cookie.HttpOnly = true;
                options.Cookie.SameSite = SameSiteMode.None;
                options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
           });
        services
           .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
           .AddCookie(options =>
           {
               // add an instance of the patched manager to the options:
               options.CookieManager = new ChunkingCookieManager();

                options.Cookie.HttpOnly = true;
                options.Cookie.SameSite = SameSiteMode.None;
                options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
           });