ASP.NET Core 2.0 JWT Validation fails with `Authorization failed for user: (null)` error

后端 未结 11 1460
暗喜
暗喜 2020-12-08 18:38

I\'m using ASP.NET Core 2.0 application (Web API) as a JWT issuer to generate a token consumable by a mobile app. Unfortunately, this token couldn\'t be validated by one con

11条回答
  •  死守一世寂寞
    2020-12-08 19:13

    try this in startup.cs

    services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
            }).AddJwtBearer(opts => ...
    

提交回复
热议问题