JWT Token Generation

Options

Ive tried the jwe/jws encoding options xano has but none seem to create a token that works for the external api authentication im trying to connect.




The only thing that has worked is a NodeJS libary 'jwt-simple'.

function(properties, context) {const jwt = require('jwt-simple');
const moment = require('moment');const payload = {
clientId: properties.clientId,
timestamp: moment().unix()
};const clientSecret = properties.clientSecret;
const token = jwt.encode(payload, clientSecret, 'HS256', {});
return {token: token}}

simple enough but cant recreate this in xano.

Ive also looked at the lambda functions and looked through the Crypto library documentations but am not sure what function to use.. im not a JS dev.

Can xano add the 'jwt-simple' library to the lambda libraries ?

Tagged:

Answers