我有一个ASP.NET Core MVC Web应用程序(.NET Core 2.1),它实现了Cookie身份验证,如下所示:
services.AddAuthentication(options => {
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
}).AddCookie(options => {
options.LoginPath = "/account/login";
options.LogoutPath = "/account/logout";
});
这个web应用还包括一个web API,客户端JavaScript通过Ajax调用返回给Web服务器。web API控制器使用[Authorize]
修饰; 在Ajax调用访问web API方法之前需要用户登录web应用程序。
我想使用Postman(Windows本地应用程序)在localhost上运行Web应用程序时测试Web API调用。我如何从浏览器中复制验证cookie到Postman中以登录?