内容
在我的项目中有mvc controller(view 和 razor Page)同时也有webapi,那么就需要网站同时支持2种认证方式,web页面的需要传统的cookie认证,webapi则需要使用...jwt认证方式,两种默认情况下不能共存,一旦开启了jwt认证,cookie的登录界面都无法使用,原因是jwt是验证http head "Authorization" 这属性.所以连login页面都无法打开...that's your requirement:
// eg: if (context.HttpContext.Request.Path.StartsWithSegments("/api...[ApiController]
[Route("api/users")]
public class UsersEndpoint : ControllerBase
{
private...token
refreshtoken
获取数据
这里获取数据的时候,其实可以不用填入token,因为调用authenticate或refreshtoken是已经记录了cookie到客户端,所以在postman