简体   繁体   English

asp.net Core 2.0无法在Safari浏览器中写入Cookie

[英]asp.net core 2.0 can not write cookie in safari browser

I am new in .net core. 我是.net核心的新手。 This is a shopify app and load on shopify's iframe. 这是一个shopify应用,可在shopify的iframe上加载。 It works great in all browsers accept Safari . 它在所有接受Safari浏览器中都很Safari Because Safari dont give permission to write cookie on browser. 因为Safari不授予在浏览器上编写Cookie的权限。 One solution is changing the browser setting.But most of client will not do that. 一种解决方案是更改浏览器设置。但是大多数客户端不会这样做。 I have to do it pragmatically. 我必须务实地做到这一点。

I hope it can be useful. 我希望它会有用。

It was extremely useful for me to read this discussion : https://github.com/IdentityServer/IdentityServer4/issues/2595 对我来说,阅读此讨论非常有用: https : //github.com/IdentityServer/IdentityServer4/issues/2595

The changes made to my service .. 对我的服务所做的更改..

 services.AddAuthentication(sharedOptions =>
{
    sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options =>
{
    options.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None;
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM