Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

JWT-WebAPI-Example

Authentication in webAPI using JWT token signed using RSA keys

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

JWT-WebAPI-Example

The example shows how we can use JWT token for authentication in webapi.To get more information on JWT please read https://en.wikipedia.org/wiki/JSON_Web_Token

Example to generate JWT token-

pascal
var utcNow = DateTime.UtcNow;
var expireTime = utcNow.Add(XmlConvert.ToTimeSpan("PT5M"));
var signingCredentials = GetCredentials();         
var token = new JwtSecurityToken(issuer, auidenceToken, null, utcNow, expireTime, signingCredentials);