JwtBearerDefaults is missing in Asp.Net Core 3.0 and 3.1

Dung Do Tien Nov 21 2020 902

Hi There,

Today I upgraded my project in Asp.Net Core version 2.2 to 3.1. I have used JWT to authenticate but after change version Asp.Net Core to 3.1 I got a compile error The name 'JwtBearerDefaults' does not exist in the current context

JwtBearerDefaults is missing in Asp.Net Core 3.0 and 3.1

It's still working well in version 2.2. I don't know why? Please suggest to me if you have any solution.

Have 1 answer(s) found.
  • M

    Manish Kumar Nov 21 2020

    Hello,
    I got the same issue. You have to install Microsoft.AspNetCore.Authentication.JwtBearer package to resolve your issue.

    - Case 1: If you convert from version 2.2 to 3.0

    Install-Package Microsoft.AspNetCore.Authentication.JwtBearer -Version 3.0.3 

    - Case 2: If you convert from version 2.2 to 3.1

    Install-Package Microsoft.AspNetCore.Authentication.JwtBearer -Version 3.1.10 

    I hope it's helpful for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close