Asp.net mvc 如何通过Chrome扩展对MVC核心应用进行身份验证?
在我的扩展清单中,我有:Asp.net mvc 如何通过Chrome扩展对MVC核心应用进行身份验证?,asp.net-mvc,google-chrome-extension,Asp.net Mvc,Google Chrome Extension,在我的扩展清单中,我有: "permissions": [ "cookies", "https://localhost:5001/" ] 在我的Startup.cs ConfigureServices方法中,我有: services.AddCors(options => { options.AddPolicy(MyAllowSpecificOrigins, builder => { builder.WithOrigins("h
"permissions": [
"cookies",
"https://localhost:5001/"
]
在我的Startup.cs ConfigureServices方法中,我有:
services.AddCors(options =>
{
options.AddPolicy(MyAllowSpecificOrigins,
builder =>
{
builder.WithOrigins("https://localhost:5001/",
"chrome-extension://mdgfojbohoeindggojmfcphhobepgcbk/");
});
});
app.UseCors(MyAllowSpecificOrigins);
在Startup.cs Configure方法中,我有:
services.AddCors(options =>
{
options.AddPolicy(MyAllowSpecificOrigins,
builder =>
{
builder.WithOrigins("https://localhost:5001/",
"chrome-extension://mdgfojbohoeindggojmfcphhobepgcbk/");
});
});
app.UseCors(MyAllowSpecificOrigins);
到目前为止,我所尝试的:
窗口。打开('Url\u of_signin\u page')
,然后在用户登录后重定向回原始页面。这将设置身份验证cookie,当我浏览到需要手动身份验证的端点时,它会工作。但是,XMLHttpRequest
调用不会发送cookie@Html.AntiForgeryToken()
显式添加到登录表单中