关于支付宝浏览器身份验证失效,无法登录。
我设置了CheckConsentNeeded:false
并且身份验证 IsEssential :true
但都在支付宝浏览器无法登录,错误日志是 :AuthenticationScheme: Cookies was not authenticated.
@dudu
public void ConfigureServices (IServiceCollection services) {
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => false;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(option => {
option.LoginPath = new PathString("/Visitor/login");
option.AccessDeniedPath = new PathString("/Visitor/Logout");
option.Cookie.Path = "/";
option.Cookie.HttpOnly = true;
option.Cookie.IsEssential = true;
});
}
public void Configure (IApplicationBuilder app, IWebHostEnvironment env) {
if (env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
} else {
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
LogManager.LoadConfiguration("nlog.config");
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints => {
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=visitor}/{action=index}/{id?}");
});
app.UseWxPayment();
}
我们设置了
options.Cookie.SameSite = SameSiteMode.Unspecified;
options.Cookie.SecurePolicy = CookieSecurePolicy.None;
没有设置
options.CheckConsentNeeded = context => false;
option.Cookie.IsEssential = true;
按照博客园这样设置 解决了
谢谢dudu
怎么打开支付宝浏览器?
– dudu 4年前@dudu: 我是一个H5的登记系统,会把网址生成二维码 别人通过微信或支付宝扫码进来注册,那支付宝扫码进到网址 就是支付宝浏览器
– Diose 4年前@dudu: 刚试了下博客园能在支付宝浏览器登录,想问下怎么设置的?
– Diose 4年前