cphilpot
cphilpot

Reputation: 1225

cant use openiddict with Microsoft.AspNetCore.Authentication.JwtBearer

I have openiddict example working but I want to use a JWT instead. I've learned that I can't use OAuth with JWT as they are two different things. Makes sense.

But if I want to use JWT then I need to install a bearer token middleware package. Which I believe, for .net core, is Microsoft.AspNetCore.Authentication.JwtBearer

But I can't install that package with openiddict at the same time. Is there a specific version of JwtBearer I need to use to make it work?

The error I get when I try to install is

Unable to resolve 'OpenIddict (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'.
Unable to resolve 'OpenIddict.Mvc (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'.
Unable to resolve 'OpenIddict.EntityFrameworkCore (>= 1.0.0)' for '.NETCoreApp,Version=v1.1'.

Openiddict package setup

<!-- OpenIdDict -->
<PackageReference Include="AspNet.Security.OAuth.Validation" Version="1.0.0-*" />
<PackageReference Include="OpenIddict" Version="1.0.0-*" />
<PackageReference Include="OpenIddict.EntityFrameworkCore" Version="1.0.0-*" />
<PackageReference Include="OpenIddict.Mvc" Version="1.0.0-*" />

NuGet Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="aspnet-contrib" value="https://www.myget.org/F/aspnet-contrib/api/v3/index.json" />
  </packageSources>
</configuration>

Upvotes: 1

Views: 1043

Answers (1)

Yevhen Bal
Yevhen Bal

Reputation: 11

Please, try to run this in Package manager console :

Install-Package OpenIddict -Version 1.0.0-beta2-0615 -Source https://www.myget.org/F/aspnet-contrib/api/v3/index.json

or

Add this package source to Nuget Package Sources: https://www.myget.org/F/aspnet-contrib/api/v3/index.json

Upvotes: 1

Related Questions