【问题标题】:Asp.Net Core 1.1 failed to use Jwt TokenAsp.Net Core 1.1 使用 Jwt Token 失败
【发布时间】:2017-11-02 14:49:12
【问题描述】:

我正在尝试在 Visual Studio 2017 中的 Web API ASP.Net Core 1.1 项目上实现 Jwt Token Auth。我按照 https://samueleresca.net/2016/12/developing-token-authentication-using-asp-net-core/ 的教程进行操作,但是当我添加 Microsoft.AspNetCore.Authentication.JwtBearer nuget 时没有可用的 app.UseJwtBearerAuthentication 方法。

我错过了什么吗?

谢谢。

【问题讨论】:

  • 你安装了哪个版本的nuget包?教程使用 1.0,但现在稳定在 1.2
  • 使用 Visual Studio 2017,我得到每个包的 1.1.2。我的目标是 .Net Core 1.1

标签: c# asp.net asp.net-web-api jwt jjwt


【解决方案1】:

我使用 dotnet cli 创建了一个新的空项目:

dotnet new webapi --framework netcoreapi1.1

它现在工作正常。 VS2017 WebAPI模板一定有问题什么的...

【讨论】:

    【解决方案2】:

    我有一个基于 ASP.NET Core 1.1、SQL Server 和 JWT 的演示项目,你可以试试:https://github.com/wilsonwu/netcoreauth

    【讨论】:

      猜你喜欢
      • 2017-03-31
      • 1970-01-01
      • 1970-01-01
      • 2018-12-22
      • 2018-07-07
      • 1970-01-01
      • 2019-10-18
      • 2019-06-26
      • 2017-11-21
      相关资源
      最近更新 更多