TrivialJwt 0.2.0

There is a newer version of this package available.
See the version list below for details.
Install-Package TrivialJwt -Version 0.2.0
dotnet add package TrivialJwt --version 0.2.0
<PackageReference Include="TrivialJwt" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TrivialJwt --version 0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TrivialJwt, 0.2.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install TrivialJwt as a Cake Addin
#addin nuget:?package=TrivialJwt&version=0.2.0

// Install TrivialJwt as a Cake Tool
#tool nuget:?package=TrivialJwt&version=0.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


TrivialJWT is a set of libraries to ease:

  • The creation of JWT tokens
  • The validation of JWT tokens

TrivialJWT exposes an end point to generate JWT token. It relies on Microsoft's libraries for JWT generation.

TrivialJWT.Bearer helps configure the Microsoft.AspNetCore.Authentication.JwtBearer library based on TrivialJWT configuration.

TrivialJWT.AspNetIdentity implements the required interfaces to bridge TrivialJWT with Microsoft.AspNetCore.Identity.

2 samples are provided:

How to use TrivialJWT with AspNetIdentity

In this example, AppUser

Install dependencies


dotnet add package TrivialJwt.Bearer
dotnet add package TrivialJwt.AspNetIdentity

or with Package Manager:

Install-Package TrivialJwt.Bearer
Install-Package TrivialJwt.AspNetIdentity

Update Startup.cs

In the example below, a HMAC-SHA265 signature

using TrivialJwt;
using TrivialJwt.AspNetIdentity;
using TrivialJwt.Bearer;

public void ConfigureServices(IServiceCollection services)
    services.AddTrivialJwtAspNetIdentity<IdentityUser>(options =>
                options.Secret = "<Base64Secret>"


public void Configure(IApplicationBuilder app, 
                IWebHostEnvironment env)




Configuration can be done by using options as shown above or by binding


For instance, the appsettings.json can contain the configuration:

    "TrivialJwt": {
        "Secret": "U3VwZXJfU2VjcmV0X1Bhc3N3b3JkIQ=="

Token generation endpoint

The endpoint is /auth/login.

The payload is a JSON file with username and password.


    "username": "bob",
    "password": "bob"

The response would be:

    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdW...k_Riw4RSK7g",
    "expires_in": 3600,
    "token_type": "bearer"


  • Support refresh token
  • support .Net 5.0
  • Implement elliptic curves
  • Enhance asymmetric key management

NuGet packages (2)

Showing the top 2 NuGet packages that depend on TrivialJwt:

Package Downloads

A Trivial package to configure token validation generated by TrivialJwt


A Trivial package to generate token based on AspNetIdentity

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.1 154 1/4/2021
0.3.0 254 12/9/2020
0.2.0 340 12/7/2020
0.1.0 191 11/30/2020