Generating JSON Web Tokens to use with Apply With DaXtra

Apply With DaXtra requires a signed JSON Web Token (jwt) to initiate the widget. This is used to authenticate you with the daxtra servers and apply any predefined configuration for your account. There are libaries in many languages to generate JWT.

The secret to use for your account will be given to you by DaXtra on signing up to a trial/demo or contract and should be kept safely on the server side of your code. It is not recommended to put the secret on the html page and use a javascript library to sign the jwt.

The payload of the signed data contains :

E.g. Here is an example written in nodejs using the jsonwebtoken library :
var token = jwt.sign({
    id : uuid(),
    exp : Math.floor(Date.now() / 1000) + (60 * 10),
    account : "demo",
    config : {}, 
},secret);
    
Here is an example written in perl using JWT::Crypt :
my $jwt = Crypt::JWT::encode_jwt('payload' => {
    'exp' => time() + (60*10),
    'account' => 'demo'
}, 'key' => $secret, 'alg' => 'HS256');