7

I've seen examples that that indicate IApplicationBuilder has an extension method .UseJwtBearerAuthentication(Action<?> options).

This SO question and AspNet.Security.OpenIdConnect.Server sample server startup file seem to say that there is such an extension. On the OpenIdConnect, I looked at the extensions folder and I don't see an extension named UseJwtBearerAuthentication. Even this blog says that it's supposed to be included with ASP.net 5. I also tried adding Microsoft.AspNet.Security.OAuthBearer, 1.0.0-beta3 to my project.json and reference it in Startup.cs. No help.

The only thing I have different is that I'm using -beta7, but I don't think that should matter.

Community
  • 1
  • 1
Mickael Caruso
  • 8,721
  • 11
  • 40
  • 72

2 Answers2

3

It depends on your runtime version. In beta7 the package is called Microsoft.AspNet.Authentication.OAuthBearer, while in beta 8 the package is renamed to Microsoft.AspNet.Authentication.JwtBearer.

Since you are using beta7, add this to your project.json:

"Microsoft.AspNet.Authentication.OAuthBearer": "1.0.0-beta7"

Pro-tip: never mix beta versions like beta3 security packages and beta7 MVC packages.

Henk Mollema
  • 44,194
  • 12
  • 93
  • 104
1

In RC2, there are

Microsoft.AspNetCore.Authentication.JwtBearer
Microsoft.AspNetCore.Authentication.OAuth
Blaise
  • 21,314
  • 28
  • 108
  • 169