addCustomClaim

addCustomClaim(claim: JadeJWTClaim);

The addCustomClaim method of the JadeJsonWebToken class adds the custom claim specified in the claim parameter to the JSON Web Token.

Create an instance of the JadeJWTClaim class, passing the claim key and value as parameters to the create method, as shown in the following example.

exampleCreateJWT();
vars
    jwt   : JadeJsonWebToken;
    claim : JadeJWTClaim;
    error : String;
begin
    create jwt transient;
    claim := create JadeJWTClaim("access", "Admin") transient;
    jwt.addCustomClaim(claim);
    write jwt.encodeHS256("Some secret that's 16+ chars", error);
epilog
    delete jwt;
    delete claim;
end;

2020.0.01 and higher