更新时间:2022-06-02 22:29:32
您需要在身份验证中间件 app.UseAuthorization()
之前添加 app.UseAuthentication()
将处理JWT承载身份验证,验证和解码令牌,最后写入用户的原则.
You need to add app.UseAuthentication()
before app.UseAuthorization()
, the authentication middleware will handle the JWT bearer authentication , validate and decode token , at last write to user's principle.