You are not logged in.
Pages: 1
Is it possible to ask to show an example relevant to Mormot2 for generating tokens and signing.
function TSimpleHttpAsyncServer.GenerateToken(const UserID: Integer): RawUTF8;
var
Claims: TJwtClaim;
JWT: RawUTF8;
begin
// Initialize the structure for storing data in the token
Claims.jrcJwtID := IntToStr(UserID);
Claims.jrcExpirationTime := DateTimeToUnixTime(Now + TOKEN_EXPIRATION_TIME);
// Generate a token and sign it using a secret key
JWT := JWTSign(TJWTAlgorithm.HS256, Claims, TOKEN_SECRET);
Result := JWT;
end;
Last edited by Terinel (2024-01-18 07:49:55)
Offline
Just use the TJwtHS256 class from mormot.crypt.jwt.
How exactly do you show a simple example
Offline
Which methods to call, in what order. What should I send there?
Offline
Pages: 1